Infoviz. Calculate tree canvas size prior to drawing

504 Views Asked by At

On my current project I'm trying to visualize tree structure using Infoviz library to display hierarchical tree structure. It works pretty well and display the tree in the form I want. But the only problem I have is that I do not find a way to draw the tree of random size.

The problem is that I need to draw the full tree with all levels and number of nodes varies according to user data. But infoviz requires canvas of fixed width and height and I didn't find a may to calculate required size prior to drawing. Now infoviz just truncates rest of the tree and there is no way to see it.

The question is: Is it possible to make get canvas size to draw the full tree?

1

There are 1 best solutions below

0
On

The canvas size is controlled via CSS. You should be able to find it in the base.css file and should look something like this:

#infovis {
    position:relative;
    width:600px;
    height:600px;
    margin:auto;
    overflow:hidden;
}

By changing the height and width, you should be able to get the size you need.

Hope that helps!