APP插件中引用Echarts写法

initCharts() {
      const echarts = require('echarts');
      // 基于准备好的dom,初始化echarts实例
      this.myChart = echarts.init(document.getElementById(this.id), 'macarons');
      this.myChart.setOption({
            grid: {
                  top: '40',
                  left: '10',
                   right: '10',
                  containLabel: true,
            },
            tooltip: {
                  trigger: 'axis',
                  axisPointer: {
                         type: 'cross',
                         label: {
                               backgroundColor: '#6a7985',
                         },
                  },
             },
            xAxis: {
                type: 'category',
                data: this.data.x,
            },
            yAxis: {
                 type: 'value',
                 name: '退款金额(万元)',
                 axisLine: { show: false },
                 axisTick: {
                show: false,
            },
            splitLine: {
              // show: true,
                  lineStyle: {
                       type: 'dashed',
                  },
             },
        },
        series: [
          {
            data: this.data.y,
            type: 'bar',
            itemStyle: {
             normal: {
                color: '#2ec7c9',
              },
            },
          },
        ],
      });
    },
最后编辑: 呼丽华  文档更新时间: 2024-03-05 11:49   作者:呼丽华