javascriptechartsapache-echarts

Apache ECharts not hiding axis pointer when programmatically hiding tooltip


I programmatically trigger a tooltip to show and to hide in my chart. I do this by dispatching the showTip and hideTip actions on the chart.

showTip triggers a tooltip to show and shows the axisPointer as well. But when dispatching hideTip the tooltip is hidden, but the axisPointer remains visible until I move my mouse inside and out of the chart canvas.

Is it possible to hide the axisPointer as well by dispatching another action. Or is this just a bug in the code of ECharts?

https://codepen.io/isazulay/pen/wvYppNN


Solution

  • This is a problem occuring for some time, reported as a bug https://github.com/apache/echarts/issues/8892 but there seems it's not a high priority.

    A hacky way I found that helps is to add a showTip with dataIndex:-1 after the hideTip

    myChart.dispatchAction({
        type: 'hideTip'
    });
    myChart.dispatchAction({
        type: 'showTip',
        seriesIndex: 0,
        dataIndex: -1
    });
    

    jsFiddle link