Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 6969

How to make link dynamic after set Spots for Individual Links?

$
0
0

@tiepna wrote:

Hi,

I'm following this code below:

diagram.nodeTemplate =
    $(go.Node, "Auto",
      $(go.Shape, "Rectangle", { fill: "lightgray" }),
      $(go.TextBlock,
        { margin: 5},
        new go.Binding("text", "key"))
    );

  diagram.linkTemplate =
    $(go.Link,
      // get the link spots from the link data
      new go.Binding("fromSpot", "fromSpot", go.Spot.parse),
      new go.Binding("toSpot", "toSpot", go.Spot.parse),
      $(go.Shape),
      $(go.Shape, { toArrow: "Standard" })
    );

  var nodeDataArray = [
    { key: "Alpha" }, { key: "Beta" }, { key: "Gamma" }, { key: "Delta" }
  ];
  var linkDataArray = [
    { from: "Alpha", to: "Beta", fromSpot: "TopRight", toSpot: "Left" },
    { from: "Alpha", to: "Gamma", fromSpot: "Left", toSpot: "Left" },
    { from: "Alpha", to: "Delta", fromSpot: "None", toSpot: "Top" }
  ];
  diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);

And by this way I calculated fromSpot and toSpot from beginning. But Issue here is: When i move node, the link not dynamic by location of nodes.
Is there anyway to make link dynamic in this case?

Sorry if the question not clear!

Thank you,

Posts: 9

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6969

Trending Articles