SOURCE

console 命令行工具 X clear

                    
>
console
console.log(222)
var chartDom = document.getElementById('echart');
var myChart = echarts.init(chartDom);
var option;

let names = ['名称0'],
  values = [0];
for (let i = 0; i < 40; i++) {
  names.push('名称' + (i + 1));
  values.push(Math.floor((1+Math.random()) * 1e6 + i));
}

option = {
    title: {
        text: '推送量统计',
        left: '50%',
        textStyle: {
          color: '#333'
        }
      },
      tooltip: {
        trigger: 'axis',
        axisPointer: {
          type: 'shadow'
        },
        formatter: function (params) {
            // params 是一个数组,数组中包含每个系列的数据信息
            var result = params[0].name + '<br/>';
            params.forEach(function (item) {
                // item 是每一个系列的数据信息
                result += item.seriesName + ': ' + (item.value - 1) + '<br/>';
            });
            return result;
        }
      },
      toolbox: {
        show: true,
        feature: {
          restore: {
            show: true,
            title: '还原',
            iconStyle: {
              borderColor: '#fff'
            }
          },
          dataView: {
            show: true,
            title: '数据视图',
            lang: ['数据视图', '关闭', '刷新'],
            iconStyle: {
              // color: '#fff',
              borderColor: '#fff'
            }
          }
        }
      },
  grid: {
    left: '7%',
    right: '2%',
    bottom: '30%'
  },
  xAxis: {
    type: 'category',
    data: names,
    nameLocation: 'center',
    axisLabel: {
      interval: 0,
      color: '#f00',
      rotate: 30,
      formatter: (val) => val
    }
  },
  yAxis:{ 
        type: 'log',
        logBase: 1e2,
        splitLine: { show: false },
        axisTick: { show: false },
        axisLine: { show: false }
    },
  series: [
    {
      data: values.map(item => item + 1),
      type: 'bar',
      selectedMode: true,
      label: {
        normal: {
          show: true,
          // position: 'top',
          formatter: (param) => {
            let _data = param.data - 1
            if (_data > 1e4) {
              if (_data % 1e4 === 0) {
                return _data / 1e4 + '万';
              } else {
                return (_data / 1e4).toFixed(2) + '万';
              }
            }
            return _data;
          },
          color: '#0f0',
          rotate: 30
        }
      },
      select: {
        itemStyle: {
          color: 'rgb(64,158,255)'
        }
      }
    }
  ]
};

option && myChart.setOption(option);
<div id="echart"> echart echart  </div>
#echart{
    width:900px;
    height:50%;
    min-height: 400px;
    border:1px solid red;
}

本项目引用的自定义外部资源