tooltip nearest point(series) logic for stockChart
When I have many (many) series on a stockChart
, I've long wished to be able to use the mouse to hover near a point and let the tooltip tell me which series it belongs too -- due to limited colors available, it becomes impossible to tell by color. Recently I was pointed to a new feature (since 5.0.10) findNearestPointBy
on stackoverflow, which seems to do exactly what I want except it doesn't appear to work in a stockChart
(as opposed to a regular chart
- even with ordinal set to false).
I've put up two examples to show the different behaviors: stockChart vs. chart, the issues are:
findNearestPointBy
does not seem to make a difference. If you place mouse directly above either of the two points next to the "bump" but at the height of the bump, the tooltip snaps to the bump onchart
but to the lower points onstockChart
.when hovering near the points from both series at the same x-value,
stochChart
tooltip shows both series whereaschart
tooltip only shows the series whose nearest point is closer - I much prefer the latter as I want the tooltip to tell me which series the nearest point belongs to.
The issue is that stockCharts have tooltip.shared enabled by default. Try this: http://jsfiddle.net/3d7hqa8d/10/
-
Kevin S. commented
fantastic - much appreciated!