loulijun2021
2023-02-12 adb74c51618faf025fe1d46bf6b22db895c2608f
src/views/bbgl/pzyc.vue
@@ -117,6 +117,8 @@
        },
        yAxis: {
          name: '数量',
          max: Math.ceil(Math.max(...this.echartsData.map(r => r.cont)) * 1.1), // 取数组里面最大的值乘1.1倍的整数的天花板
          interval: 1,
          nameTextStyle: {
            color: '#000',
            fontSize: 16,
@@ -177,13 +179,19 @@
          height: 15,
          start: 1,
          end: 35
        }
        ],
        series: [{
          name: '数量',
          type: 'bar',
          barWidth: '15%',
          label: {
            show: true,
            position: 'top',
            textStyle: {
              color: '#000'
            }
          },
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
@@ -245,30 +253,30 @@
      const myChart = echarts.init(document.getElementById('Echarts'))
      setInterval(function() {
        var dataLen = option.series[0].data.length
        // 取消之前高亮的图形
        myChart.dispatchAction({
          type: 'downplay',
          seriesIndex: 0,
          dataIndex: app.currentIndex
        })
        app.currentIndex = (app.currentIndex + 1) % dataLen
        // console.log(app.currentIndex);
        // 高亮当前图形
        myChart.dispatchAction({
          type: 'highlight',
          seriesIndex: 0,
          dataIndex: app.currentIndex
        })
        // 显示 tooltip
        myChart.dispatchAction({
          type: 'showTip',
          seriesIndex: 0,
          dataIndex: app.currentIndex
        })
      }, 1000)
      // setInterval(function() {
      //   var dataLen = option.series[0].data.length
      //
      //   // 取消之前高亮的图形
      //   myChart.dispatchAction({
      //     type: 'downplay',
      //     seriesIndex: 0,
      //     dataIndex: app.currentIndex
      //   })
      //   app.currentIndex = (app.currentIndex + 1) % dataLen
      //   // console.log(app.currentIndex);
      //   // 高亮当前图形
      //   myChart.dispatchAction({
      //     type: 'highlight',
      //     seriesIndex: 0,
      //     dataIndex: app.currentIndex
      //   })
      //   // 显示 tooltip
      //   myChart.dispatchAction({
      //     type: 'showTip',
      //     seriesIndex: 0,
      //     dataIndex: app.currentIndex
      //   })
      // }, 1000)
      if (option.textStyle == null) {
        option.textStyle = {