配置项如下
var img = {
'a': '/asset/get/s/data-1559121268278-ozjd-lXoz.png',
'b': '/asset/get/s/data-1559121263841-UC5w7mTJ9.png',
'c': '/asset/get/s/data-1559121259198-sxyPSimU9.png',
'd': '/asset/get/s/data-1559121254241-xj5JAIBzC.png',
'e': '/asset/get/s/data-1559121249274-QxHDAdQGy.png',
};
let links = [],
data = []
option = {
xAxis: {
show: false,
type: 'value'
},
yAxis: {
show: false,
type: 'value'
},
series: [{
type: 'graph',
layout: 'none',
edgeSymbol: ['circle', 'none'],
edgeSymbolSize: [0, 15],
focusNodeAdjacency: true,
roam: true,
lineStyle: {
normal: {
width: 1,
shadowColor: 'none',
color: '#ff0000'
},
},
symbolSize: [250, 70],
symbol: "roundRect",
label: {
show: true,
formatter: function(params) {
let b = params.data.num
let c = params.data.Place
var str = '';
switch (params.data.level) {
case 'first':
str = '{a|}' + '{d|' + b + '}' + '{x|' + c + '}';
break;
case 'sconed':
str = '{b|}' + '{d|' + b + '}\n{e|' + c + '}';
break;
case 'three':
str = '{c|}' + '{d|' + b + '}\n{e|' + c + '}';
break;
}
return str
},
rich: {
a: {
width: 38,
height: 38,
backgroundColor: {
image: img.a
},
},
b: {
width: 38,
height: 38,
backgroundColor: {
image: img.b
},
align: 'left'
},
c: {
width: 38,
height: 38,
backgroundColor: {
image: img.c
},
},
d: {
fontSize: 16,
color: "#555",
align: 'left',
padding: [0, 0, 0, 10]
},
x: {
fontSize: 12,
color: "#1ab4b8",
align: 'left',
},
e: {
fontSize: 14,
color: "#ccc",
align: 'left',
padding: [0, 0, 0, 45]
},
}
},
itemStyle: {
normal: {
color: '#fff',
shadowColor: 'rgba(225,225,225,0.4)',
shadowBlur: 10,
shadowOffsetX: 10,
shadowOffsetY: 10,
},
},
data: [{
level: "first",
name: "源端IP",
num: "94.102.57.216",
Place: "(荷兰)",
x: 80,
y: 150,
}, {
level: "sconed",
name: "访问时间1",
num: "2019-11-23",
Place: "访问了2个IP",
x: 200,
y: 120,
}, {
level: "sconed",
name: "访问时间2",
num: "2019-11-22",
Place: "访问了2个IP",
x: 200,
y: 90,
},
{
level: "three",
name: "目的端IP1",
num: "134.83.4.46",
Place: "35次|193.95KB",
x: 300,
y: 100,
}, {
level: "three",
name: "目的端IP2",
num: "134.83.4.47",
Place: "35次|193.95KB",
x: 300,
y: 50,
}
],
links: [{
source: "源端IP",
target: "访问时间1",
}, {
source: "源端IP",
target: "访问时间2",
}, {
source: "访问时间2",
target: "目的端IP1",
}, {
source: "访问时间1",
target: "目的端IP1",
}, {
source: "访问时间1",
target: "目的端IP2",
}, {
source: "访问时间2",
target: "目的端IP2",
}],
}]
};