Centering a node when using the Hierarchical Layout
10 views
Skip to first unread message
Eamo
unread,
Oct 29, 2009, 9:51:24 AM10/29/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to BirdEye
Hi.
I'm using the Hierarchical Layout for my graph. At times I need a non-
root node to be the top center node while still showing the hierarchy
from the root node to my "center" node. I thought that scrolling the
graph to the node in question would do the trick:
var centerNode:IVisualNode = diagram.graph.nodeByStringId
(centerNodeId).vnode;
var width:Number = centerNode.vgraph.width/2 - centerNode.x;
diagram.scroll(-width, -centerNode.y);
It doesn't work though and on further investigation I found it was
failing because all my nodes have the same (x,y) coords (even though
they are correctly positioned on the screen).
Any ideas what i am doing wrong?