Toggle navigation
用户分类关系图graph
By
m***3
2018-10-26 09:32:33
脚本
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
图表已生成
整理代码
刷新
代码
const roles = ['商户', '客户', '司机', '收货人', '发货人', '质检员', '库管', '采购员', '风控', '付款专员'] function generateRandom(min, max) { return (min + Math.round(Math.random() * (max - min))) } let links = [], data = [] roles.map((v, k) => { var num = generateRandom(5, 99999) if(k > 0) { data.push({ name: v, value: num, category: 1 }) links.push({ source: 0, target: k, value: num }) } else { data.push({ name: v, value: num, category: 0, symbolSize: 100 }) } }) option = { animationEasingUpdate: 'quinticInOut', series: [{ type: 'graph', layout: 'force', force: { repulsion: 3000, edgeLength: [150, 10], // layoutAnimation:false }, // 节点标记类型 symbol: 'circle', symbolSize: 70, // 两端标记类型 edgeSymbol: ['circle', 'circle'], edgeSymbolSize: [12, 20], focusNodeAdjacency: true, // 鼠标经过节点是否突出显示 roam: false, // 是否开启鼠标平移 draggable: false, // 节点是否可拖拽 label: { normal: { show: true, position: 'inside', textStyle: { fontSize: 12 }, } }, lineStyle: { normal: { opacity: 1, color: { colorStops: [{ offset: 0, color: '#FEE52D' }, { offset: 1, color: '#F89212' }] }, width: 3 } }, itemStyle: { normal: { color: '#162436', borderColor: { colorStops: [{ offset: 0, color: '#A568FF' }, { offset: 1, color: '#006CFF' }] }, borderWidth: 6 } }, // 节点分类 categories: [{ name: 'root', label: { formatter: '{b}', fontSize: 20 }, itemStyle: { color: '#132486' } }, { name: 'child', label: { formatter: ['{a|{c}}', '{b|{b}}'].join('\n'), rich: { a: { color: '#0ff', align: 'center', }, b: { color: '#fff', align: 'center', lineHeight: 24 } } } }], // 数据 data, // 节点间关系数据 links }] }; myChart.on("mouseover", function(data) { // 取消节点连接线触发效果 if (data.dataType == "edge") { myChart.dispatchAction({ type: 'unfocusNodeAdjacency', seriesIndex: 0 }); } })