Creating multiple vertical tree layouts


Is it possible to create multiple vertical tree layouts in the same diagram?
what we need is something like here: Org Chart Static

if you look at the bottom left of the diagram, there are vertical parts in the layout.

what we need to implement is multiple of those but each with one parent and 1-3 children.

thank you

If you copied the TreeLayout initialization that the Org Chart (static) sample uses, does that work for you?

only if the children have a parent and a grandparent,
if the children have only a parent, the children are organized horizontally instead of vertically.

That requires figuring out beforehand whether or not there is a grandparent – i.e. at least three levels in the tree.

Such computation could be done in a custom TreeLayout class. Or you could figure that out yourself and then set the Diagram.layout to either the TreeLayout from Org Chart Static (or a suitably modified version – whatever works for you) or else to another TreeLayout where all of the non-“alternate” properties are set to those “alternate” value from Org Chart Static. TreeLayout | GoJS API

what i basically need is this:

but without the root node. every thing else is exactly as I need

I need the parents organized horizontally and the children vertically

Get your TreeLayout set up so that you get the results that you want when there’s just one parent and it has two children.

Then you’ll have two TreeLayout configurations. You can have two instances of TreeLayout, one for each set of properties and set Diagram.layout appropriately. Or you could just have one instance of TreeLayout, and you modify its properties appropriately.

Either way, I think you’ll also want to set TreeLayout.arrangement to go.TreeLayout.ArrangementHorizontal. That ensures that multiple trees are arranged horizontally.

I’m not sure i understand,
Let’s try to simplfy the scenario.
Suppose that i have a root node and 3 children nodes. I would like the children nodes to span vertically right below the root node.
When i used the Org Chart Static sample and went down to 4 nodes (1 root, 3 children), here is the result.

So, i can i layout them vertically ?

Yes, assign the “alternate…” property values from the Org Chart Static sample TreeLayout to the non-“alternate…” property values for your TreeLayout.

now , i see,