Continue Showing Same Tooltip On Dynamic Graph (Until Mouse Moves)
See original GitHub issueOne-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).
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
@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 thehideTip
action from getting dispatched, so you can’t actually hide the tooltip in any way whiletooltip.alwaysShowContent
istrue
.Fortunately, I was able to get the desired effect by binding a callback to the chart’s
globalout
event, which settooltip.alwaysShowContent
tofalse
, and then waiting a tick before dispatching thehideTip
action.Hopefully this information helps someone else in a similar situation!
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!