javascript – 如何在GoJS中动态添加节点数据和链接数据?

前端之家收集整理的这篇文章主要介绍了javascript – 如何在GoJS中动态添加节点数据和链接数据?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
myDiagram.model = new go.GraphLinksModel(
[

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

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

我需要动态添加更多值,我该怎么做?

解决方法

节点数据(来源: GoJS docs,class Model):

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

链接数据(来源:GoJS docs,class GraphLinksModel):

If you want to add or remove link data from the linkDataArray,call the 07004 or 07005 methods. If you want to modify the node a link connects to,call the 07006 and/or 07007 methods.

原文链接:https://www.f2er.com/js/150971.html

猜你在找的JavaScript相关文章