How to vertically center nodes in a custom LayeredDigraphLayout

Hi,

I’m using AlignedLayeredDigraphLayout (custom layout that i found on this forum) that works great with alligning all the nodes to the left.
however, i would like to also vertically center the nodes.
this is how it looks now:

and i would like it to look similar to:

these is the lyout settings:
myDiagram.groupTemplate = (go.Group, "Vertical", { avoidable: false, fromSpot: go.Spot.LeftRightSides, toSpot: go.Spot.LeftRightSides, layout: (AlignedLayeredDigraphLayout, {
columnSpacing: 10,
layerSpacing: 100,
layeringOption: go.LayeredDigraphLayout.LayerOptimalLinkLength,
aggressiveOption: go.LayeredDigraphLayout.AggressiveMore,
initializeOption: go.LayeredDigraphLayout.InitDepthFirstIn,
packOption: go.LayeredDigraphLayout.PackAll,
setsPortSpots: false
})
// more stuff…
})

Can this be achieved?
Thanks.

Are there 3 groups in your screenshot, and do they all use the same template and settings for the layout?

yes you are correct.

I’m not sure what’s going on. Normally LayeredDigraphLayout does center-align nodes in adjacent layers if they are connected, although it snaps nodes to the grid established by the columnSpacing property so they might not be exactly centered.

We’ll look into this later today.

thanks, waiting for your replay.

One other think, i don’t understand why the layout isn’t trying to avoid crossing links (there is any other setting that might help that i’m missing?)

I’m not sure that the layout recognizes that there is an unnecessary crossing of links there, because some of the links connect with a member node, but one connects with the group. That latter link might have been routed more towards the bottom of the group, in which case there would be no link crossing – yet the nodes on the left would not have changed order at all.

Can i affect the drawing orders of the items? some kind of sort?

With LayeredDigraphLayout, not really. Some other layouts such as TreeLayout and GridLayout do support sorting and custom ordering functions.

OK, this bug took a while to track down and fix. Please try the latest beta (1.8.19) at GoJS - Build Interactive Diagrams for the Web.

Thank you very much, it looks better now.