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
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?

Thanks,
Eamo.
Reply all
Reply to author
Forward
0 new messages