桑基图

描述:当前是关于Echarts图表中的 桑基图 示例。
 
            colorList = [
      "#f7a365",
      "#44eda1",
      "#00ffff",
      "#00baff",
      "#f8b551",
      "#7ecef4",
      "#7ecef4",
      "#7ecef4",
      "#7ecef4",
      "#7ecef4",
      "#7ecef4",
      "#7ecef4",
      "#7ecef4",
    ];
option = {
        tooltip: {
          trigger: "item",
          triggerOn: "mousemove",
        },
        grid: {
          top: "25px",
          left: "10px",
          right: "10px",
          bottom: "6%",
          containLabel: true,
        },
        series: {
          type: "sankey",
          layout: "none",
          top: "2%",
          bottom: "5%",
          left: "5%",
          right: "13%",
          lineStyle: {
            opacity: 0.3,
            color: "gradient",
            curveness: 0.7,
          },
          label: {
            color: "#000",
            fontSize: 15,
            formatter: function (params, i) {
              // console.log(params);
              // return "{white|" + params.data.name + "\n}" + params.data.nameValue + " " + params.data.valueUnit;
            },
            rich: {
              white: {
                fontSize: 20,
                padding: [10, 0, 0, 0],
              },
            },
          },
          nodeGap: 20,
          layoutIterations: 1,
          emphasis: {
            focus: "adjacency",
          },
          data: [
        { name: "电网", itemStyle: { color: colorList[0] }, depth: 0 },
        { name: "光伏", itemStyle: { color: colorList[1] }, depth: 0 },
        { name: "配电房", itemStyle: { color: colorList[2] }, depth: 1 },
        { name: "综合楼", itemStyle: { color: colorList[3] }, depth: 2 },
        { name: "1#厂房", itemStyle: { color: colorList[4] }, depth: 2 },
        { name: "5#厂房", itemStyle: { color: colorList[5] }, depth: 2 },
        { name: "6#厂房", itemStyle: { color: colorList[6] }, depth: 2 },
      ],
          links: [
        // L1→L3	 4509
        { source: "电网", target: "配电房", value: 800 },
        // L2→L3	 12196
        { source: "光伏", target: "配电房", value: 200 },
        // L1→L2→L3	 2404
        { source: "配电房", target: "综合楼", value: 200 },
        { source: "配电房", target: "1#厂房", value: 300 },
        { source: "配电房", target: "5#厂房", value: 400 },
        { source: "配电房", target: "6#厂房", value: 100 },
      ],
        },
      };