# Echarts 力导向图
const option = {
series: [{
type: 'graph',
layout: 'force',
roam: true,
nodes: nodes,
links: links,
force: {
repulsion: 200,
gravity: 0.01,
edgeLength: 200
},
labelLayout: {
hideOverlap: true
},
scaleLimit: {
min: 0.4,
max: 2
},
lineStyle: {
color: 'source',
curveness: 0.01
},
itemStyle: {
color: {
type: "radial",
x: 0.5,
y: 0.5,
r: 0.5,
colorStops: [
{
offset: 0,
color: "#3dd67a", // 0% 处的颜色
},
{
offset: 0.7,
color: "#3dd67a", // 0% 处的颜色
},
{
offset: 1,
color: "#95dcb2", // 100% 处的颜色
},
],
global: false, // 缺省为 false
},
},
label: {
show: true,
position: "bottom",
distance: 5,
fontSize: 18,
align: "center",
},
autoCurveness: 0.01, //多条边的时候,自动计算曲率
graphic: {
color: [
'#5470c6',
'#91cc75',
'#fac858',
'#ee6666',
'#73c0de',
'#3ba272',
'#fc8452',
'#9a60b4',
'#ea7ccc']
},
}]
};