3

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

Inbar Azulay
  • 247
  • 1
  • 4
  • 25

1 Answers1

1

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

kikon
  • 3,670
  • 3
  • 5
  • 20
  • 1
    Thanks! This workaround indeed works well. And since it's a bug this is probably the best way to tackle this problem – Inbar Azulay May 08 '23 at 07:27