echarts
echarts copied to clipboard
Continue Showing Same Tooltip On Dynamic Graph (Until Mouse Moves)
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:
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).
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
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.
Can you try with tooltip.alwaysShowContent
?
@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!
That is a problem brought by upgrading axisPointer
one day. I should think about a thorough solution to it.
Is there a fix or workaround planned for this ?
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
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
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.
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!