Auto alignment of links based on node center

As seen the example BPMN we have an option align nodes & all the nodes get aligned based on node axis . Is there a way where links also can automatically aligned to node center so that we get a straight line between nodes ?

When I open the BPMN sample,, I find that the links do connect automatically toward the node center.

However, if there are more than one link at a side, the links are spread out along that side. This is because the GraphObject.fromSpot and GraphObject.toSpot are set to Spots that are “…Side” values. See, for example.

But that spreading behavior is just the default routing behavior for “…Side” spot ports. You can change that behavior by setting I’m guessing that you want to set it to go.Node.SpreadingNone.

how can i align links & nodes in straight line?

The user can position them the way that they like.

You could enable grid-snapping along with Node.locationSpot being go.Spot.Center. See

You can provide guidelines, as demonstrated in, by using

You could align programmatically yourself or by implementing your own custom Layout or using an existing layout such as TreeLayout.