terezka / elm-charts

Create SVG charts in Elm.
https://www.elm-charts.org
BSD 3-Clause "New" or "Revised" License
711 stars 67 forks source link

Scatter point hint accuracy #47

Closed chancyk closed 7 years ago

chancyk commented 7 years ago

It can be difficult or impossible to display hints for a particular scatter plot point by default, which may be an artifact of how the mouse pixel position resolves to plot coordinates.

Some kind of tolerance may need to be applied to capture points near the mouse position, though this could be confusing if the X coordinate of the hint is not the same as the actual X coordinate location of the mouse, for instance if the hint for a line is also being display. Since it's up to the user code to display to the hint anyway maybe it's more appropriate for the user code to handle this situation, which should be possible since HintInfo provides the xValue.

The relevant code is here: https://github.com/terezka/elm-plot/blob/master/src/Plot.elm#L700

terezka commented 7 years ago

I'm working on something to solve this in the next version! Thanks for the inspiration!