桑基图

描述:当前是关于Echarts图表中的 桑基图 示例。
 
            const sankeyData = [
   { name: '工学', itemStyle: { color: '#0081d4' } },
   { name: '管理学', itemStyle: { color: '#00bc13' } },
   { name: '理学', itemStyle: { color: '#0174c6' } },
   { name: '法学', itemStyle: { color: '#00b564' } },
   { name: '经济学', itemStyle: { color: '#00bc13' } },
   { name: '艺术学', itemStyle: { color: '#0081d4' } },
   { name: '文学', itemStyle: { color: '#d56920' } },
   { name: '教育学', itemStyle: { color: '#00bc13' } },
   { name: '医学', itemStyle: { color: '#d56920' } },
   { name: '电力、热力、燃气及水生产和供应业', itemStyle: { color: '#d56920' } },
   { name: '住宿和餐饮业', itemStyle: { color: '#00bc13' } },
   { name: '制造业', itemStyle: { color: '#00bc13' } },
   { name: '交通运输、仓储和邮政业', itemStyle: { color: '#00bc13' } },
   { name: '建筑业', itemStyle: { color: '#0081d4' } },
   { name: '批发和零售业', itemStyle: { color: '#00bc13' } },
   { name: '居民服务、修理和其他服务业', itemStyle: { color: '#0081d4' } },
   { name: '房地产业', itemStyle: { color: '#00bc13' } },
   { name: '信息传输、软件和信息技术服务业', itemStyle: { color: '#d56920' } },
   { name: '科学研究和技术服务业', itemStyle: { color: '#d56920' } },
   { name: '金融业', itemStyle: { color: '#0081d4' } },
   { name: '租赁和商务服务业', itemStyle: { color: '#00bc13' } },
   { name: '文化、体育和娱乐业', itemStyle: { color: '#d56920' } },
   { name: '卫生和社会工作', itemStyle: { color: '#00bc13' } }
]
const linksData = [
   { source: '工学', target: '电力、热力、燃气及水生产和供应业', value: 1 },
   { source: '工学', target: '住宿和餐饮业', value: 1 },
   { source: '工学', target: '制造业', value: 1 },
   { source: '工学', target: '交通运输、仓储和邮政业', value: 1 },
   { source: '工学', target: '建筑业', value: 1 },
   { source: '工学', target: '批发和零售业', value: 1 },
   { source: '工学', target: '居民服务、修理和其他服务业', value: 1 },
   { source: '工学', target: '房地产业', value: 1 },
   { source: '工学', target: '信息传输、软件和信息技术服务业', value: 1 },
   { source: '工学', target: '科学研究和技术服务业', value: 1 },
   { source: '工学', target: '金融业', value: 1 },
   { source: '工学', target: '租赁和商务服务业', value: 1 },
   { source: '管理学', target: '制造业', value: 1 },
   { source: '管理学', target: '交通运输、仓储和邮政业', value: 1 },
   { source: '管理学', target: '建筑业', value: 1 },
   { source: '管理学', target: '批发和零售业', value: 1 },
   { source: '管理学', target: '居民服务、修理和其他服务业', value: 1 },
   { source: '管理学', target: '房地产业', value: 1 },
   { source: '管理学', target: '信息传输、软件和信息技术服务业', value: 1 },
   { source: '管理学', target: '科学研究和技术服务业', value: 1 },
   { source: '管理学', target: '金融业', value: 1 },
   { source: '管理学', target: '租赁和商务服务业', value: 1 },
   { source: '管理学', target: '文化、体育和娱乐业', value: 1 },
   { source: '理学', target: '科学研究和技术服务业', value: 1 },
   { source: '法学', target: '科学研究和技术服务业', value: 1 },
   { source: '经济学', target: '信息传输、软件和信息技术服务业', value: 1 },
   { source: '经济学', target: '科学研究和技术服务业', value: 1 },
   { source: '经济学', target: '金融业', value: 1 },
   { source: '经济学', target: '租赁和商务服务业', value: 1 },
   { source: '艺术学', target: '科学研究和技术服务业', value: 1 },
   { source: '艺术学', target: '租赁和商务服务业', value: 1 },
   { source: '艺术学', target: '文化、体育和娱乐业', value: 1 },
   { source: '文学', target: '科学研究和技术服务业', value: 1 },
   { source: '文学', target: '租赁和商务服务业', value: 1 },
   { source: '文学', target: '文化、体育和娱乐业', value: 1 },
   { source: '教育学', target: '租赁和商务服务业', value: 1 },
   { source: '医学', target: '租赁和商务服务业', value: 1 },
   { source: '医学', target: '卫生和社会工作', value: 1 }
]
option = {
   backgroundColor: '#001552',
   tooltip: {
      trigger: 'item',
      triggerOn: 'mousemove'
   },
   series: [
      {
         type: 'sankey',
         layout: 'none',
         layoutIterations: 0,
         width: 550,
         nodeWidth: 20,
         emphasis: {
            focus: 'adjacency'
         },
         data: sankeyData,
         links: linksData,
         itemStyle: {
            color: '#31a3a0'
         },
         label: {
            color: '#a1b4cf',
            fontFamily: 'Arial',
            fontSize: 12,
            fontWeight: 700
         },
         lineStyle: {
            color: 'source',
            curveness: 0.5
         }
      }
   ]
};