MCPcopy
hub / github.com/apache/echarts / addNode

Method addNode

src/data/Graph.ts:70–89  ·  view source on GitHub ↗

* Add a new node

(id: string | number, dataIndex?: number)

Source from the content-addressed store, hash-verified

68 * Add a new node
69 */
70 addNode(id: string | number, dataIndex?: number): GraphNode {
71 id = id == null ? ('' + dataIndex) : ('' + id);
72
73 const nodesMap = this._nodesMap;
74
75 if (nodesMap[generateNodeKey(id)]) {
76 if (__DEV__) {
77 console.error('Graph nodes have duplicate name or id');
78 }
79 return;
80 }
81
82 const node = new GraphNode(id, dataIndex);
83 node.hostGraph = this;
84
85 this.nodes.push(node);
86
87 nodesMap[generateNodeKey(id)] = node;
88 return node;
89 };
90
91 /**
92 * Get node by data index

Callers 2

createGraphFromNodeEdgeFunction · 0.95
cloneMethod · 0.95

Calls 1

generateNodeKeyFunction · 0.85

Tested by

no test coverage detected