配置项如下
option = {
tooltip: { trigger: 'item', triggerOn: 'mousemove' },
series: {
type: 'sankey',
layout: 'none',
top: '12px',
bottom: '4px',
right: '72px',
left: 'left',
draggable: false,
containLabel: { show: true },
data: [
{ name: '二级', itemStyle: { color: '#DECBE4' } },
{ name: '销售A组', itemStyle: { color: '#DECBE4' } },
{ name: '4444444', itemStyle: { color: '#CCEBC5' } },
{ name: '销售B组', itemStyle: { color: '#B3CDE3' } },
{ name: '999999', itemStyle: { color: '#FBB4AE' } },
{ name: '00', itemStyle: { color: '#269FFF' } },
{ name: '生产部', itemStyle: { color: '#637CFF' } },
{ name: '市场部', itemStyle: { color: '#F56828' } },
{ name: '我是测试1级1', itemStyle: { color: '#5A77FA' } },
{ name: '电力', itemStyle: { color: '#6565ff' } },
{ name: '水类', itemStyle: { color: '#ff6d6d' } },
{ name: '天然气', itemStyle: { color: '#DBEED7' } },
{ name: '我是测试1级的子1级', itemStyle: {} },
{ name: '研发部', itemStyle: {} },
{ name: '销售部', itemStyle: {} },
{ name: '办公', itemStyle: {} },
{ name: '照明', itemStyle: {} },
{ name: '动力', itemStyle: {} },
{ name: '1级损耗', itemStyle: {} },
{ name: '损耗', itemStyle: {} },
],
links: [
{ source: '天然气', target: '研发部', value: '0.00', lineStyle: { color: 'orange' } },
{ source: '我是测试1级1', target: '我是测试1级的子1级', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '我是测试1级的子1级', target: '二级', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '二级', target: '4444444', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '销售部', target: '销售B组', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '销售A组', target: '999999', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '销售A组', target: '00', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '销售部', target: '销售A组', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '销售部', target: '销售A组', value: '0.00', lineStyle: { color: 'orange' } },
{ source: '天然气', target: '市场部', value: '0.00', lineStyle: { color: 'orange' } },
{ source: '天然气', target: '我是测试1级1', value: '0.00', lineStyle: { color: 'orange' } },
{ source: '天然气', target: '生产部', value: '89.00', lineStyle: { color: 'orange' } },
{ source: '天然气', target: '销售部', value: '0.00', lineStyle: { color: 'orange' } },
{ source: '电力', target: '我是测试1级1', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '电力', target: '销售部', value: '9.00', lineStyle: { color: '#6565ff' } },
{ source: '电力', target: '市场部', value: '86.32', lineStyle: { color: '#6565ff' } },
{ source: '电力', target: '研发部', value: '23.00', lineStyle: { color: '#6565ff' } },
{ source: '电力', target: '生产部', value: '20.00', lineStyle: { color: '#6565ff' } },
{ source: '水类', target: '我是测试1级1', value: '59.62', lineStyle: { color: '#ff6d6d' } },
{ source: '水类', target: '1级损耗', value: '48.62', lineStyle: { color: '#ff6d6d' } },
{ source: '天然气', target: '1级损耗', value: '20.64', lineStyle: { color: 'orange' } },
{ source: '电力', target: '1级损耗', value: '43.00', lineStyle: { color: '#6565ff' } },
{ source: '1级损耗', target: '损耗', value: '20.64', lineStyle: { color: 'orange' } },
{ source: '1级损耗', target: '损耗', value: '48.62', lineStyle: { color: '#ff6d6d' } },
{ source: '1级损耗', target: '损耗', value: '43.00', lineStyle: { color: '#6565ff' } },
{ source: '999999', target: '办公', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '研发部', target: '办公', value: '0.00', lineStyle: { color: 'orange' } },
{ source: '市场部', target: '办公', value: '86.32', lineStyle: { color: '#6565ff' } },
{ source: '00', target: '办公', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '研发部', target: '照明', value: '23.00', lineStyle: { color: '#6565ff' } },
{ source: '生产部', target: '照明', value: '20.00', lineStyle: { color: '#6565ff' } },
{ source: '生产部', target: '照明', value: '89.00', lineStyle: { color: 'orange' } },
{ source: '销售B组', target: '照明', value: '0.00', lineStyle: { color: '#6565ff' } },
{ source: '市场部', target: '照明', value: '0.00', lineStyle: { color: 'orange' } },
{ source: '4444444', target: '动力', value: '0.00', lineStyle: { color: '#6565ff' } },
],
curveness: 0.5,
layoutIterations: 0,
nodeGap: 20,
},
};