-
tnJune 30, 2016 at 12:55 pm #6287
Hi Vizuly,
Thank you for the great visualization modules and library. I am trying to use the weighted tree with a different dataset that has fewer secondary nodes. When I clean the sample dataset to only have 4 nodes for example the 1st level node moves upwards towards the top of the screen. How can I move it back down to the middle? I can send you a screenshot if desired.
Thank you,
TNvizulyJune 30, 2016 at 3:22 pm #6288Hi TN,
The weighted tree has some scrolling features built into the layout that allow you to programmatically scroll to a certain node. This feature isn’t demonstrated in the test container, but it is there.
As a result the layout algorithm is slightly more complex and does its best to maximize the space for a given set of nodes – thus inconsistent result you are seeing with the position of the first node.
A quick fix would be to add this line of code at the end of the
positionNodes()
function insidesrc/viz/weightedtree.js
at approximately line 378.root.x = 0 + tree.nodeSize()[0];
This should ensure the node is always centered vertically in the screen. (Note the x,y positions of the node are transposed in the treeview so x = y and y = x. I know it is confusing, but the original d3 tree layout assumes a vertical orientation.
– Tom
tnJune 30, 2016 at 7:49 pm #6291Hi Tom,
Thank you very much. I have one more conceptual question I will post in a different thread.
Thank you,
TN -
|
You must be logged in to reply to this topic.