• 小程序中tab切换时,隐藏echarts中上一个tooltip数据


    切换事假中清除echart

      checkNav(e){
        this.setData({
          activeIndex: e.currentTarget.dataset.index,
          activeName: e.currentTarget.dataset.navname,
        })
        tab1Echart.dispatchAction({
          type: 'updateAxisPointer',
          currTrigger: 'leave'
       })
        this.getNewRevenue()
      },

    echarts代码

    import * as echarts from '../../../ec-canvas/echarts';
    let tab1Echart = null
    function lineOption(tab1Xdata, y1Data, y2Data,y3Data){
      let option = {
        title: {
          text: tab1Xdata.length==0?'暂无数据':'',
          x: 'center' ,
          y: 'center' ,
          textStyle: {
              color: '#bcbcbc',
              fontWeight: 600,
              fontSize:  16
          }
        },
        legend: {
          selectedMode: false,
          // data: [tab1Line1Name, tab1Line2Name],
          top: '2%',
          left: 'left',
          backgroundColor: '#fff',
          z: 100,
        },
        grid: {
          left: '3%',right: '3%',top: '20%',bottom: '3%',
          containLabel: true
        },
        tooltip: {
          show: true,
          trigger: 'shadow',
          axisPointer:{
            shadowStyle:{
              color: 'rgba(150,150,150,0.3)'
            }
          }
        },
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: tab1Xdata,
        },
        yAxis: {
          type: 'value',
          x: 'center',
          splitLine: {
            lineStyle: {
              type: 'dashed'
            }
          },
        },
        series: []
      };
      return option
    }
    let xData = [], onedata = [],twodata = [], beonline = []
    function initChart(canvas, width, height) {
      tab1Echart = echarts.init(canvas, null, {
         width,
        height: height
      });
      canvas.setChart(tab1Echart);
      // tab1Echart.showLoading({
      //   text: 'loading',
      //   color: '#c23531',
      //   textColor: '#000',
      //   maskColor: 'rgba(255, 255, 255, 0.2)',
      //   zlevel: 0,
      // });
      var option = lineOption(xData, onedata, twodata, beonline)
      tab1Echart.setOption(option);
      return tab1Echart;
    }
  • 相关阅读:
    校内模拟赛 虫洞(by NiroBC)
    校内模拟赛 旅行(by NiroBC)
    P3830 [SHOI2012]随机树
    4358: permu
    【noi.ac】#309. Mas的童年
    P1438 无聊的数列
    2091: [Poi2010]The Minima Game
    LOJ #6074. 「2017 山东一轮集训 Day6」子序列
    LOJ #6068. 「2017 山东一轮集训 Day4」棋盘
    LOJ #6073. 「2017 山东一轮集训 Day5」距离
  • 原文地址:https://www.cnblogs.com/xhrr/p/16005363.html
Copyright © 2020-2023  润新知