plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.95k stars 1.86k forks source link

Use hoverdistance with hovermode closest #3569

Closed mmustala closed 4 months ago

mmustala commented 5 years ago

Hi.

My chart shows a lot of scatter lines and using the default hovermode became very verbose. Changing to hovermode 'closest' helped with it a lot. But now it is rather difficulty to hit some data points (candlesticks next to a scatter point especially) to see the hover box. I tried to set hoverdistance to 100 but it doesn't seem to have effect with this hovermode. But it would be really nice if it would show all hover items within the range defined with hoverdistance. But maybe just one item per data set, the one that is closest in the x axis.

Another way to reach this would be to have separate setting for x and y hoverdistance. Then I could use the default hovermode but define y hoverdistance to something like 10. Then it would show the hover items that are within the rectangle defined by the x and y hoverdistances.

etpinard commented 5 years ago

Thanks for writing in.

Could you share a reproducible (ideally in a codepen) of the situation you're describing? hoverdistance appears to be working ok on graphs with hovermode: 'closest', example:

https://codepen.io/etpinard/pen/modbWY

mmustala commented 5 years ago

What I meant is that it would show all points that are within the hoverdistance. The code in this pen demonstrates that it shows only one point even though two points from different data sets are within the range.

https://codepen.io/anon/pen/qvNobN

I think this kind of feature would require a new hovermode. Maybe in-range?

etpinard commented 5 years ago

Related: https://github.com/plotly/plotly.js/issues/720

gvwilson commented 4 months ago

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson