gpt4 book ai didi

javascript - GoJS中如何动态添加Node数据和Link数据?

转载 作者:数据小太阳 更新时间:2023-10-29 04:32:12 30 4
gpt4 key购买 nike

 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 addNodeData or removeNodeData methods.

链接数据(来源: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.

关于javascript - GoJS中如何动态添加Node数据和Link数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28525407/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com