Open AlanFoster opened 6 years ago
No, there's no support for closest line.
You can highlight the line under the cursor which if I remember correctly is actually a larger hit area than the line itself. That approach works for us, but we usually don't have so many lines as in your link.
Beyond that, as you say, you can manage this outside the library by using the tracker position (try onMouseMove
to grab the x, y position and onTrackerChanged
to give you the time) and then choosing whichever line you want based on that information.
I'll mark this item as an enhancement though, since it's a reasonable request.
Thanks for the quick reply @pjm17971 :+1:
you can manage this outside the library by using the tracker position (try onMouseMove to grab the x, y position and onTrackerChanged to give you the time) and then choosing whichever line you want based on that information.
Is that currently possible without the yScale being exposed by this component? 🤔
Yeah, you're right, that would be tricky. There's actually multiple scales associated with that area too, to make things more complicated. So perhaps there's no easy way to get the effect you want right now. I'll think about it a little more though.
Awesome, any help would be appreciated! :+1:
Is it possible to highlight the closest line to the user's mouse position?
For instance like - http://dygraphs.com/gallery/#g/highlighted-series
I've been poking around the source code and documentation and I can see that it's easy to get the X position via
onTrackerChanged
and usingseries.AtTime(tracker)
, but from what I can tell there's no way to calculate the closest line based on its Y position? 🤔