柱状图

描述:当前是关于Echarts图表中的 示例。
 
                  let barName = ['冶金行业', '商贸行业', '有色金属', '建筑行业', '其它'];
      let barData = [110, 100, 90, 80, 120, 150];
      var maxNum = 0;
      for (var i = 0; i < barData.length; i++) {
        if (barData[i] > maxNum) {
          maxNum = barData[i];
        }
      }
      let option = {
        grid: {
          left: '20%',
          right: '18%',
          bottom: '6%',
          top: '12%',
          containLabel: false,
        },
        backgroundColor: '#0e1c47',
        xAxis: {
          show: false,
          type: 'value'
        },
        yAxis: [{
          type: 'category',
          inverse: true,
          offset: 70,
          position: 'left',
          axisLabel: {
            show: true,
            align: 'left',
            textStyle: {
              color: '#fff',
              fontSize: 14,
            },
            formatter: function (value, index) {
              var num = '';
              var str = '';
              num = index + 1;
              str = '{name|' + barName[index] + '}';
              return str;
            },
            rich: {
              name: { color: '#fff', fontSize: 14, padding: [-42, 130, 2, 80] },
            },
          },
          splitLine: {
            show: false,
          },
          axisTick: {
            show: false,
          },
          axisLine: {
            show: false,
          },
          data: barName
        }, {
          type: 'category',
          inverse: true,
          axisTick: 'none',
          axisLine: 'none',
          show: false,
          axisLabel: {
            textStyle: {
              color: '#ffffff',
              fontSize: 14
            },
            formatter: function (value) {
              return value + ' %';
            },
          },
          data: barData
        }],
        series: [

        {
          type: 'bar',
          zlevel: 1,
          itemStyle: {
            normal: {
              barBorderRadius: 0,
              color: "#17A7AA"
            },
          },
          barWidth: 14,
          data: barData,
          label: {
            show: true,
            position: 'right',
            distance: -6,
            align: "right",
            rich: {
              rightname: { color: '#fff', fontSize: 14, padding: [4, -2, 0, 0] },
            },
            formatter: function (params) {
              return '{rightname|' +  (Math.floor(params.data / (maxNum+70) * 100)) + '%' + '}';
            },
          },
        },
        {
          type: 'bar',
          barWidth: 14,
          barGap: '-100%',
          data: barData.map(function (item) {
            return {
              realValue: item,
              value: maxNum + 70,
            };
          }),
          label: {
              show: true,
              position: 'right',
              distance: 40,
              align: "right",
              formatter: function (params) {
                return params.data.realValue;
              },
              color: '#13C5C1',
              fontSize: 15,
            },
          itemStyle: {
            normal: {
              color: 'rgba(23,167,170,0.4)',
            }
          },
        },
      ],
      }