1. links 为 id (string类型 name重复不会有问题)
data.push({
"name": item.name,
"symbolSize": size,
"draggable": false,
"id": String(item.id),
"itemStyle":{
"color": color
}
});
links.push({
"source": String(sourceid),
"target": String(item.id),
"lineStyle": {
curveness: index > 3 ? 0.1 : 0,
}
});
2. links 为name
节点中增加showName
link 中用 name 作为关系对应 但是每一级的name后面 增加唯一标识 比如当前遍历轮询的下标(保证name 不重复)
显示的时候增加showName 作为显示
showName 为真实名字 此时,即使重复也不会有影响,如下
label: {
normal: {
show: true,
formatter: function(params){
return params.data.showName
}
}
},
tooltip: {
show: true,
formatter: function(params){
return params.data.showName
}
}