daisybaicai / project-problem

记录日常遇到的problem
0 stars 0 forks source link

echarts 移动端tooltip关闭的问题 #3

Open daisybaicai opened 3 years ago

daisybaicai commented 3 years ago

鼠标移动到下方以后,无法正常的关闭

daisybaicai commented 3 years ago

apache/echarts#12778

daisybaicai commented 3 years ago

apache/echarts#5782

daisybaicai commented 3 years ago
myChart.dispatchAction({
    type: 'hideTip'
});
myChart.dispatchAction({
    type: 'updateAxisPointer',
    currTrigger: 'leave'
})
Flourad commented 3 years ago
myChart.dispatchAction({
    type: 'hideTip'
});
myChart.dispatchAction({
    type: 'updateAxisPointer',
    currTrigger: 'leave'
})

请问这个是在什么时间调用呢?

daisybaicai commented 3 years ago
myChart.dispatchAction({
    type: 'hideTip'
});
myChart.dispatchAction({
    type: 'updateAxisPointer',
    currTrigger: 'leave'
})

请问这个是在什么时间调用呢?

比如你那个echarts图表,你想点击了以后出现tooltip,然后往下滚动的时候,就消失tooltip,你就绑定scroll事件。

document.addEventListener("scroll", this.handleTouch);
    handleTouch(e) {
      const myChart = this.chartInstance
      setTimeout(() => {
        myChart.dispatchAction({
          type: "hideTip"
        });
        myChart.dispatchAction({
          type: "updateAxisPointer",
          currTrigger: "leave"
        });
      }, 0);
    }
Flourad commented 3 years ago
myChart.dispatchAction({
    type: 'hideTip'
});
myChart.dispatchAction({
    type: 'updateAxisPointer',
    currTrigger: 'leave'
})

请问这个是在什么时间调用呢?

比如你那个echarts图表,你想点击了以后出现tooltip,然后往下滚动的时候,就消失tooltip,你就绑定scroll事件。

document.addEventListener("scroll", this.handleTouch);
    handleTouch(e) {
      const myChart = this.chartInstance
      setTimeout(() => {
        myChart.dispatchAction({
          type: "hideTip"
        });
        myChart.dispatchAction({
          type: "updateAxisPointer",
          currTrigger: "leave"
        });
      }, 0);
    }

这样会不会有性能问题:

  1. 滚动事件被频繁触发,这个dispatchAction也会频繁被触发?
  2. 如果tooltip没有出现的话,也会调用关闭tooltip,会不会有啥问题?
daisybaicai commented 3 years ago
myChart.dispatchAction({
    type: 'hideTip'
});
myChart.dispatchAction({
    type: 'updateAxisPointer',
    currTrigger: 'leave'
})

请问这个是在什么时间调用呢?

比如你那个echarts图表,你想点击了以后出现tooltip,然后往下滚动的时候,就消失tooltip,你就绑定scroll事件。

document.addEventListener("scroll", this.handleTouch);
    handleTouch(e) {
      const myChart = this.chartInstance
      setTimeout(() => {
        myChart.dispatchAction({
          type: "hideTip"
        });
        myChart.dispatchAction({
          type: "updateAxisPointer",
          currTrigger: "leave"
        });
      }, 0);
    }

这样会不会有性能问题:

  1. 滚动事件被频繁触发,这个dispatchAction也会频繁被触发?
  2. 如果tooltip没有出现的话,也会调用关闭tooltip,会不会有啥问题?

仅仅是提供一个大概的思路

Flourad commented 3 years ago
myChart.dispatchAction({
    type: 'hideTip'
});
myChart.dispatchAction({
    type: 'updateAxisPointer',
    currTrigger: 'leave'
})

请问这个是在什么时间调用呢?

比如你那个echarts图表,你想点击了以后出现tooltip,然后往下滚动的时候,就消失tooltip,你就绑定scroll事件。

document.addEventListener("scroll", this.handleTouch);
    handleTouch(e) {
      const myChart = this.chartInstance
      setTimeout(() => {
        myChart.dispatchAction({
          type: "hideTip"
        });
        myChart.dispatchAction({
          type: "updateAxisPointer",
          currTrigger: "leave"
        });
      }, 0);
    }

这样会不会有性能问题:

  1. 滚动事件被频繁触发,这个dispatchAction也会频繁被触发?
  2. 如果tooltip没有出现的话,也会调用关闭tooltip,会不会有啥问题?

仅仅是提供一个大概的思路 嗯嗯 还是 非常感谢~