echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Continue Showing Same Tooltip On Dynamic Graph (Until Mouse Moves)

Open adamtLICOR opened this issue 6 years ago • 9 comments

One-line summary [问题简述]

Is there a simple way to continue showing the same tooltip on a dynamic graph (until the mouse moves)?

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 4.1.0 (via vue-echarts 3.1.3)
  • Browser version [浏览器类型和版本]: Chrome 69.0.3497.100
  • OS Version [操作系统类型和版本]: OSX High Sierra (10.13.6)

Expected behaviour [期望结果]

I have a graph that adds one new data point to a series every second. I can highlight any of those points, and the tooltip shows up just fine:

screen shot 2018-10-17 at 5 14 29 pm

However, when the graph updates the data after the next second, the tooltip moves on to the next point (because that point is now highlighted).

This makes it difficult to read any tooltip data.

Is there an easy way to keep showing the first tooltip, preferably until the mouse moves (to signal that another tooltip should be shown)?

NOTE: I have tried using the alwaysShowContent option, and that works somewhat. However, the tooltip shows for the currently selected point, and then changes to show for the next point in the series. After that happens, the tooltip does stay on the screen.

ECharts option [ECharts配置项]

option = {
    tooltip: {
        trigger: 'axis'
    }
    ...
    xAxis: {
       type: 'category'  
   }
}

Other comments [其他信息]

A similar issues appears on the Dynamic Graph example on the official docs page: https://ecomfe.github.io/echarts-examples/public/editor.html?c=dynamic-data2

However, here, the tooltip usually disappears entirely (because no point is highlighted at all).

adamtLICOR avatar Oct 17 '18 22:10 adamtLICOR

sorry,I don't fully understand what you mean. Maybe you can add markPoint in your series, like this http://echarts.baidu.com/examples/editor.html?c=line-marker

deqingli avatar Oct 18 '18 04:10 deqingli

My graph updates every second, and when it does, the cursor is no longer hovering over the same data point, so the shown tooltip changes (or disappears, depending on how the graph moves).

I want the tooltip to stay visible, until I move the mouse.

ghost avatar Oct 18 '18 15:10 ghost

Can you try with tooltip.alwaysShowContent?

Ovilia avatar Oct 26 '18 03:10 Ovilia

@Ovilia Yes, I actually ended up using tooltip.alwayShowContent.

However, one problem that I ran into is that tooltip.alwaysShowContent literally always shows the tooltip, even when the mouse cursor is no longer hovering over the graph.

Additionally, tooltip.alwaysShowContent appears to actively block the hideTip action from getting dispatched, so you can't actually hide the tooltip in any way while tooltip.alwaysShowContent is true.

Fortunately, I was able to get the desired effect by binding a callback to the chart's globalout event, which set tooltip.alwaysShowContent to false, and then waiting a tick before dispatching the hideTip action.

Hopefully this information helps someone else in a similar situation!

ghost avatar Oct 26 '18 15:10 ghost

That is a problem brought by upgrading axisPointer one day. I should think about a thorough solution to it.

100pah avatar Oct 29 '18 16:10 100pah

Is there a fix or workaround planned for this ?

i0x915 avatar Dec 02 '18 03:12 i0x915

Is there any fix or workaround? I am also stuck with tooltip.alwaysShowContent solution suggested by @Ovilia but as @adamtLICOR said it blocks the hideTip action from getting dispatched. Thus looking for a discrete solution

AmitBisht14 avatar Aug 05 '20 11:08 AmitBisht14

In detail workaround as suggested by @adamtLICOR set tooltip.alwaysShowContent to false. After this you have to set the chart options which will reset tooltip property of alwaysShowContent thus it won't suppress hideTip dispatchAction

AmitBisht14 avatar Aug 05 '20 19:08 AmitBisht14

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] avatar Aug 05 '22 21:08 github-actions[bot]

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

github-actions[bot] avatar Aug 12 '22 21:08 github-actions[bot]