Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic TreeLayout, when Root has parents and children (Read 2742 times)
Jeff Shields
Guest


TreeLayout, when Root has parents and children
Sep 20th, 2005 at 4:56pm
Print Post  
In several cases where we're using Flowchart, our data is best represented as a linear tree. However, we need to show the parents and children of the Root node. As we're using the arrows, that means that the parents are on the tail end of arrows pointing to the root.

With default TreeLayout settings, all of the Parent nodes are left in the upper left corner (we are dynamically placing them). After setting IgnoreArrowDirection to false, the functionality is slightly better, but leaves all first level parent/child nodes in the same level.

Given a TopToBottom direction, what we desire is that the parents are shown hierarchically above the root node, and the children below.

Is there an elegant way to do this?

Thanks for any tips,
Jeff
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout, when Root has parents and children
Reply #1 - Sep 21st, 2005 at 4:34am
Print Post  
Try calling the TreeLayout twice.

The first time set ReversedArrows = false and call Arrange; that arranges the 'children' branch. The second time set ReversedArrows = true and KeepRootPos = true, then call Arrange; that arranges the 'parents' branch of the tree.

KeepRootPos glues the two branches together, by arranging the parent above the root without moving the root itself.

Hope this helps,
Stoyan
  
Back to top
 
IP Logged
 
Jeff Shields
Guest


Re: TreeLayout, when Root has parents and children
Reply #2 - Sep 21st, 2005 at 11:56am
Print Post  
Adding a direction reversal to that provided exactly the results we're looking for; thanks for the quick and helpful response!

The resulting code looks something like this:
  tl.Direction = TreeLayoutDirection.TopToBottom;
  tl.ReversedArrows = false;
  tl.KeepRootPosition = false;
  tl.Arrange(chart);

  tl.Direction = TreeLayoutDirection.BottomToTop;
  tl.ReversedArrows = true;
  tl.KeepRootPosition = true;
  tl.Arrange(chart);
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint