Graph -双向箭头如何在线的两边出现文字
配置项如下
option = {
title: {
text: 'Graph 简单示例'
},
// tooltip: {},
series: [{
type: 'graph',
layout: 'force',
symbolSize: 60,
roam: true,
edgeSymbol: ['circle', 'arrow'],
edgeSymbolSize: [4, 10],
focusNodeAdjacency: true,
force: {
repulsion: 1200,
edgeLength: 300,
gravity: 0.4,
},
symbol: "circle",
itemStyle: {
normal: {
color: '#0084ff'
}
},
lineStyle: {
normal: {
width: 2
}
},
edgeLabel: {
normal: {
show: true,
formatter: function(x) {
return x.data.name;
}
}
},
label: {
normal: {
show: true,
textStyle: {
fontSize: 10
}
}
},
data: [{
"name": "公司1"
}, {
"name": "公司2"
}],
// links: [],
links: [{
"source": "公司1",
"target": "公司2",
"name": "控股20",
"label": {
color: 'red',
verticalAlign: 'bottom',
padding: [10, 10, 10, 10],
padding: 0,
"show": true
}
}, {
"source": "公司2",
"target": "公司1",
"name": "控股30",
"label": {
color: 'blue',
verticalAlign: 'top',
padding: [10, 10, 10, 10],
"show": true
}
}]
}]
};