电量柱状图

描述:当前是关于Echarts图表中的 柱状图 示例。
 
              let list = [{
      name: '无人机',
      value: 36
    }, {
      name: '视频监控',
      value: 25
    }, {
      name: '人工发现',
      value: 30
    }];
    let yName = list.map((item) => item.name);
    let xData = list.map((item) => item.value);
    let barWidth = 16;
    let totaldata=[100,100,100]

    option = {
       backgroundColor: '#0A2E5D',
      xAxis: {
        splitLine: {
          show: false
        },
        axisLabel: {
          show: false
        },
        axisTick: {
          show: false
        },
        axisLine: {
          show: false
        }
      },
      grid: {
        containLabel: true,
        left: 6,
        top: 0,
        right: 100,
        bottom: 0
      },
      yAxis: [{
        inverse: true,
        axisLine: {
          show: false
        },
        axisTick: {
          show: false
        },
        axisLabel: {
          margin: 10,
          textStyle: {
            fontSize: 14,
            color: '#fff'
          }
        },
        data: yName,
      }],
      series: [{ //内
        type: 'bar',
        barWidth,
        legendHoverLink: false,
        symbolRepeat: true,
        silent: true,
        itemStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 1,
            y2: 0,
            colorStops: [{
              offset: 0,
              color: '#00abee' // 0% 处的颜色
            }, {
              offset: 1,
              color: '#62E6F6' // 100% 处的颜色
            }]
          }
        },
        data: list,
        z: 1,
        animationEasing: 'elasticOut'
      },
      { // 背景
        type: 'pictorialBar',
        animationDuration: 0,
        symbolRepeat: 'fixed',
        symbolMargin: '20%',
        symbol: 'roundRect',
        symbolSize: [6, barWidth],
        itemStyle: {
          normal: {
            color: 'transparent',
          }
        },
        label: {
          normal: {
            show: true,
            position: 'right',
            offset: [0, 2],
            distance: 20,
            textStyle: {
              color: '#7AF8FF',
              fontSize: 14,
            },
            formatter: function (a, b) {
              console.log(a);
              console.log(b);
              return `${a.value}%`
            }
          },

        },
        data: xData,
        z: 0,
        animationEasing: 'elasticOut'
      },
      { //分隔
        type: 'pictorialBar',
        itemStyle: {
          color: '#194ebc'
        },
        symbolRepeat: 'fixed',
        symbolMargin: 4,
        symbol: 'roundRect',
        symbolClip: true,
        symbolSize: [2, barWidth],
        symbolPosition: 'start',
        symbolOffset: [0, 0],
        data: list,
        z: 2,
        animationEasing: 'elasticOut'
      },
      ]
    };