Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Hover info in scatter graph

I have this scatter graph, and i would like to have the hover info in the line above.
For the same X value i have two Y values.
When i put the mouse cursor in the red point (view attached image) the hover info apper in the lane below
How can i solve this problem?

You’ll need to make sure both traces have the same (or similar enough) x coordinates.

plotly.js only shows hover labels in the vicinity of the data you provide. That is, it doesn’t interpolate between data points to make the hover labels match across all traces.

Thanks for your feedback. Maybe i haven’t explained the problem correctly…

I don’t have two traces. Is only one trace

There’s a no way to make a single trace show multiple hover labels via the API.

You’ll need to play around with plotly_hover events. See https://plot.ly/javascript/hover-events/#coupled-hover-events for an example.

I had the same problem. These is a simple solutions for this: just add

‘hovermode’ : ‘closest’ to your layout.