We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DirectedTreeLayout vs HierarchicalTreeLayout and Level

I am having a lot of trouble with the tree layouts. I finally decided to use the DirectedTreeLayout because when a new node is added the HierarchicalTreeLayout messes the whole layout, switching from Left to right, so some pseudo right to left approach, and half of my nodes are on top of each other.  With the DirectedTreeLayout it seems to work correctly for the most part. My Root node is on the left and the children are branch out towards to right, and are all spaced appropriately.

However, I started to have trouble when I was looking at the case where a particular node might have multiple parents. The layout is much the same as it was before, except that there is a connector that crosses over other nodes to reach its other parent.  I didn't like that too much.  So because of my particular hierarchy of objects, I though I could make use of the Level field to adjust the layout slightly.

I have attached a picture of a simple example of what I was trying to do. The first image is what happens, and the second is what I was expecting to see.  Each letter represents a different type of object.  I was assuming that this would simplify the layout for more complex examples so that it would prevent connection lines from crossing all over my nodes.

However, it would seem that assigning Levels doesn't seem to have any effect whatsoever on where the nodes are placed.  Other than individually placing each node at a specific pixel, which I REALLY didn't want to start getting into, what can I do?

Part of the reason I don't want to place the nodes myself, is that it is possible going forward that I want my nodes to be of different sizes (depending on the types and the contents), and I was hoping the automatic layout would do the heavy lifting. It is looking more and more like the layout is not going to help me.


1 Reply

SC Sudhakar C Syncfusion Team November 20, 2013 09:45 AM UTC

Hi Elizabeth,

Regarding to set the Level property of the Node, we didn’t consider the level property to place the Node in the Layout. We have used the Level property only in HierarchicalTree Layout, but in HierarchicalTree Layout, we are using the Level property to check some conditions only. We didn’t place the Node with the reference of Level property in Layout.

Regarding connector overlapping on the Node when a node having Multiple Parents, by default, If any node having multiple parent in Layout, we will consider any one of it’s parent node internally and arrange that child node in Layout based on the considered parent node. We didn’t consider the remaining parents to place that child node.

For example, consider, we have NodeA, NodeB & NodeC.  Assume, Parent Node for NodeC is NodeA & NodeB. Now, we will consider NodeA / NodeB internally and place NodeC in layout based on considered Node.  

Please let us know if you have any concerns on this.


Sudhakar C

Live Chat Icon For mobile
Up arrow icon