因为项目的需要,在关系图展示中,会有name数据重复的情况,不能去重,因为重复的那个节点会有相应的与其对应的其他不同于之前的数据。但是现在name一旦重复就会报错,图出不来,请问有什么api可以设置,或避免这个问题么?
配置项如下
var datas=[],links=[],categories=[];
datas=[
{
name:'echart',
category:'0',
symbolSize: 42
},{
name:'e',
category:'1',
symbolSize: 26
},
{
name:'c',
category:'1',
symbolSize: 28
},{
name:'h',
category:'1',
symbolSize: 24
},{
name:'a',
category:'1',
symbolSize: 20
},{
name:'r',
category:'1',
symbolSize: 16
},{
name:'t',
category:'1',
symbolSize: 16
},{
name:'s',
category:'2',
symbolSize: 16
},/*{
name:'t',
category:'3',
symbolSize: 14
},{
name:'abc',
category:'4',
symbolSize: 14
}*/
];
links=[
{
source: 'echart',
target: 'e'
},{
source: 'echart',
target: 'c'
},{
source: 'echart',
target: 'h'
},{
source: 'echart',
target: 'a'
},{
source: 'echart',
target: 'r'
},{
source: 'echart',
target: 't'
},{
source: 't',
target: 's'
},/*{
source: 's',
target: 't'
},{
source: 't',
target: 'abc'
}*/
];
categories=[
{
name:'0'
},{
name:'1'
},{
name:'2'
},{
name:'3'
},{
name:'4'
}
]
option = {
animationDuration: 500,
animationEasingUpdate: 'quinticInOut',
series: [{
name: '区域经济主题视图',
type: 'graph',
layout: 'force',
force: {
initLayout: 'circular',
repulsion: 320,
gravity:0.2
},
draggable: "true",
data:datas,
links:links,
categories:categories,
focusNodeAdjacency: true,
roam: true,
label: {
normal: {
show: true,
position: 'top',
}
},
lineStyle: {
normal: {
color: 'source',
curveness: 0.2,
type: "solid"
}
}
}]
};