Links Going Over from Nodes

image

I am using TreeLayout. Following is my layout code.

go.GraphObject.make(go.TreeLayout, { nodeSpacing: 20, nodeIndent: 0, nodeIndentPastParent: 0, layerSpacing: 50, layerSpacingParentOverlap: 0, sorting: go.TreeLayout.SortingForwards, compaction: go.TreeLayout.CompactionBlock, breadthLimit: 0, rowSpacing: 25, rowIndent: 10, setsPortSpot: true, setsChildPortSpot: true, treeStyle: go.TreeLayout.StyleLastParents, layerStyle: go.TreeLayout.LayerIndividual, alignment: go.TreeLayout.AlignmentCenterChildren, angle: 90, arrangement: go.TreeLayout.ArrangementHorizontal });

The problem with this is the link passes from Node. I want that link should not pass from Node and also links should not overlap each other.

I have used AvoidNodes as well but it doesnt seems to be working in this case.

 var newRouting = go.Link.AvoidsNodes;
        this.diagram.startTransaction("update routing");
        this.diagram.linkTemplate.routing = newRouting;
        this.diagram.links.each(function (l) {
            l.routing = newRouting;
        });
        this.diagram.commitTransaction("update routing");

First, what is the layout that you really want in this case? Could you please move the nodes where you would want them to be, and then route the links the way you would then want them to go? I really cannot guess what you want – there are too many plausible possibilities.

Second, I assume there are Groups. Did you want the layout to be determined by each Group? If so, each Group.layout needs to be set the way that you want. If not, then maybe you want each Group.layout to be null, so that it is only the Diagram.layout that controls the positioning of all of the connected nodes, completely ignoring the groups.

Third, Groups are Nodes. So links that are trying to AvoidNodes will want to try to avpid groups. But that’s impossible when trying to route between nodes that are within nodes (groups). Maybe you want to consider setting Group.avoidable to false.