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 do I do this?

+6
source share
1 answer

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

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

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

If you want to add or remove link data from linkDataArray, call addLinkData or removeLinkData . If you want to change the node link that the link refers to, call setFromKeyForLinkData and / or setToKeyForLinkData .

+10
source

Source: https://habr.com/ru/post/982515/


All Articles