Toggle navigation
网络节点关系图
By
高***2
2020-03-31 07:07:42
脚本
16
21
作品使用的第三方脚本
数据管理
上传数据
支持小于 5M 任意格式(csv, xlsx, json, xml, ...)的数据文件
上传后可以通过生成的文件链接异步获取托管的数据。
历史数据
0 条
无历史数据
代码修改记录
信息提示
保存作品
对当前截图不满意?你还可以
上传本地截图
重新截图
作品名称
作品描述
标签
geo
grid
legend
markLine
markPoint
bar
effectScatter
line
lines
map
timeline
title
toolbox
tooltip
visualMap
作品默认版本
最新
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
20:11:45
图表已生成
整理代码
刷新
代码
data=[ {name:"HTTPS",sip:"192.168.0.1",dip:"192.168.1.1"}, {name:"HTTP",sip:"192.168.0.2",dip:"192.168.1.2"}, {name:"FTP",sip:"192.168.0.3",dip:"192.168.1.3"}, {name:"FTP1",sip:"192.168.0.4",dip:"192.168.1.4"}, {name:"FTP2",sip:"192.168.0.5",dip:"192.168.1.5"}, {name:"FTP3",sip:"192.168.0.6",dip:"192.168.1.6"} ] let halfWidth = 150; let halfHeight = 50; let halfItemwidth = 85; let halfItemHeight = 20; let curveness0 = { normal: { curveness: 0 } }; let curveness1 = { normal: { curveness: 0.6 } }; let curveness2 = { normal: { curveness: -0.6 } }; let curveness3 = { normal: { curveness: 0 } }; var seriesData = [], seriesData1 = [], seriesData2 = [], links = []; let len = data.length, stepx = 600, stepy = 500; data.forEach((item, ind) => { //line表示的是第几行 let line = parseInt(ind / 3); //判断奇偶行 0:偶数行 非 0:奇数行 let reminder = line % 2; let radioX = reminder == 0 ? ind % 3 : 2 - (ind % 3); //横坐标的步长系数 // 所有的name索引优先排列(广度优先顺序) seriesData1.push({ name: item.name, x: halfWidth + stepx * radioX, y: halfHeight + stepy * line, value: 67, category: 0, symbol: "roundRect", symbolSize: [150, 30] }); let branch = { value: 12, category: 2, label: { normal: { position: "right" } } }; // name同项的稍后排列 seriesData2.push( { name: item.sip, x: halfWidth + stepx * radioX, y: halfHeight + stepy * line + 100, ...branch }, { name: item.dip, x: halfWidth + stepx * radioX, y: halfHeight + stepy * line + 160, ...branch } ); // 根据索引生成不同项之间的线性关系 // let curve = (ind+1)%3==0&&(ind+1)/3>0?//判断拐点时曲线的弯曲方向 let curve = curveness3; curve = ((ind + 1) / 3) % 2 == 0 ? curveness2 : ((ind + 1) / 3) % 2 == 1 ? curveness1 : curveness3; //判断拐点的奇偶 0:偶数 非0:奇数 if (ind < len - 1) { links.push( { source: ind, target: ind + 1, lineStyle: curve }, { source: ind, target: 2 * ind + len, lineStyle: curveness2 }, { source: ind, target: 2 * ind + len + 1, lineStyle: curveness2 } ); } else { links.push( { source: ind, target: 2 * ind + len, lineStyle: curveness2 }, { source: ind, target: 2 * ind + len + 1, lineStyle: curveness2 } ); } }); seriesData = seriesData1.concat(seriesData2); option = { color: ["#096DD9", "#1890FF", "#40A9FF"], series: [ { type: "graph", force: { repulsion: 2000 }, roam: true, label: { normal: { show: true } }, categories: [ { name: "事件" }, { name: "行业" }, { name: "个股" } ], data: seriesData, links, lineStyle: curveness1, lineStyle: { normal: { opacity: 0.9, width: 1.5, curveness: 0 } } } ] };