Cycle link in layeredDiagramLayout cross each other

Hi there,

I have a layered diagram which has cyclic links. At the moment it looks like this

As you can see the backflow links makes the diagram has lots of "8"s . The layout is within a group, so I have the group template setup like the following

return GO(
      isShadowed: true,
      isSubGraphExpanded: false,
      layerName: BACKGROUND,
      layout: GO(go.LayeredDigraphLayout),
      padding: 40,
      portSpreading: go.Node.SpreadingEvenly,
      selectionObjectName: CONTAINER,
      shadowVisible: false,
      fromSpot: go.Spot.RightSide,
      toSpot: go.Spot.LeftSide,

I would like the backflow links they goes to either the top or bottom of the boundary first, then go back to the source node. The path is more like a retangle box, instead of taking a short cut like this.


I just tried a minimal case of what you show. Here’s the complete sample:

<!DOCTYPE html>
  <title>Minimal GoJS Sample</title>
  <!-- Copyright 1998-2021 by Northwoods Software Corporation. -->
  <script src="go.js"></script>
  <script id="code">
  function init() {
    var $ = go.GraphObject.make;

    myDiagram =
      $(go.Diagram, "myDiagramDiv",
          layout: $(go.LayeredDigraphLayout)

    myDiagram.nodeTemplate =
      $(go.Node, "Auto",
          { fill: "white" },
          new go.Binding("fill", "color")),
          { margin: 8 },
          new go.Binding("text"))

    myDiagram.linkTemplate =
        { curve: go.Link.Bezier },

    myDiagram.model = new go.GraphLinksModel(
      { key: 1, text: "Alpha", color: "lightblue" },
      { key: 2, text: "Beta", color: "orange" },
      { key: 3, text: "Gamma", color: "lightgreen" },
      { key: 4, text: "Delta", color: "pink" }
      { from: 1, to: 2 },
      { from: 1, to: 3 },
      { from: 1, to: 4 },
      { from: 2, to: 1 },
      { from: 3, to: 1 },
      { from: 4, to: 1 }
<body onload="init()">
  <div id="myDiagramDiv" style="border: solid 1px black; width:100%; height:600px"></div>

And here’s the result:

Yes, that’s strange, I dont know why it happens on my local. Can you think of any reason? The differernce between your demo and my code is my graph is within a group, so it’s basically a layeredDiagramLayout subgraph.

I found the issue. Thanks

What was the issue? Other people might benefit from knowing what was misconfigured.