tnJune 30, 2016 at 12:55 pm #6287
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.
TNvizulyJune 30, 2016 at 3:22 pm #6288
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
src/viz/weightedtree.jsat approximately line 378.
root.x = 0 + tree.nodeSize();
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.
– TomtnJune 30, 2016 at 7:49 pm #6291
Thank you very much. I have one more conceptual question I will post in a different thread.
You must be logged in to reply to this topic.