Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Node data and Link data dynamically in GoJS?

 myDiagram.model = new go.GraphLinksModel(
[

  { key: "Alpha", color: "lightblue" },
  { key: "Delta", color: "pink" }

],
[
  { from: "Alpha", to: "Alpha" },
  { from: "Delta", to: "Alpha" }
]);

I need to add more values dynamically, how should I do this?

like image 545
user3675515 Avatar asked Feb 15 '15 11:02

user3675515


1 Answers

Node data (source: GoJS docs, class Model):

If you want to add or remove node data from the nodeDataArray, call the addNodeData or removeNodeData methods.

Link data (source: GoJS docs, class GraphLinksModel):

If you want to add or remove link data from the linkDataArray, call the addLinkData or removeLinkData methods. If you want to modify the node a link connects to, call the setFromKeyForLinkData and/or setToKeyForLinkData methods.

like image 149
Alex Shesterov Avatar answered Oct 23 '22 04:10

Alex Shesterov