It looks like you want a TreeLayout whose “last parents” (i.e. parent nodes whose children are all leaf nodes) want to lay out their children in a vertical stack.
You can do that without overriding any TreeLayout methods by using these properties on the TreeLayout:
$(go.Diagram, "myDiagramDiv",
{
. . .
layout:
$(go.TreeLayout,
{
treeStyle: go.TreeLayout.StyleLastParents,
arrangement: go.TreeLayout.ArrangementHorizontal,
// properties for most of the tree:
angle: 90,
layerSpacing: 35,
// properties for the "last parents":
alternateAngle: 0,
alternateLayerSpacing: 35,
alternateAlignment: go.TreeLayout.AlignmentStart,
alternateNodeIndent: 10,
alternateNodeIndentPastParent: 1.0,
alternateNodeSpacing: 10,
alternateLayerSpacing: 30,
alternateLayerSpacingParentOverlap: 1.0,
alternatePortSpot: new go.Spot(0.01, 1, 10, 0),
alternateChildPortSpot: go.Spot.Left
}),
. . .
It is not “last parents”, it depends on “halign” parameter on each node. My question is just how to put that Yellow node below red and not next to it.
This is how it looks like: http://www.nwoods.com/forum/uploads/5813/index.jpg
First, you should not be depending on the minified names of any properties in your code. You want to write: v.node.data.halign
Second, I’m not sure what you want, but I suspect setting some more of the properties that I showed above would help. Just remember that properties named “alternate…” on TreeLayout are just values for TreeVertex properties named without the “alternate” prefix.
First, “alternateChildPortSpot” is not a defined property on TreeVertex, as I explained above. You should be setting v.childPortSpot.
Second, there is no go.Spot.Down. That’s just undefined.
I suggest you set the TreeVertex properties in your assignTreeVertexValues override that I earlier did via the TreeLayout.alternate… default properties. You’ll want to set those properties on all TreeVertexes corresponding to red Nodes and all of their children.