echarts
echarts copied to clipboard
graph links的source和target有问题
graph links的source和target有问题,现在source和target用的是node.data的数组key去连线的,而文档标的是graph.node 的 name,换成name后线出不来,建议用id来获取node。
建议src/data/Graph.js 129行改为:
if (typeof n1 === 'number') {
n1 = this.getNodeById(n1);
}
if (typeof n2 === 'number') {
n2 = this.getNodeById(n2);
}
我刚提交了跟你相似的问题,才看到你的。用你的方式,直接解决了我的问题。
name 和 数组 index 都是可以的,如果有 id 优先取 id
看了源码,可以这么解决,把links里面的source/target全部换成字符串就oK了!