Black Lives Matter. Please consider donating to Black Girls Code today.

Hover data passed with event are inaccurate/wrong/misleading?


Assuming I have a chart with 2 traces that doesn’t always match their points on X axis, I’m trying to interpolate value of missing points for second trace. I will than display interpolated value to the user.
I assumed I could use plotly_hover event to pass me a value of X I’m currently hovering over.

However, moving my mouse slightly over chart area (hovered point doesn’t change, tooltip is still on same point) results in different values passed. I’ve prepared quick demo here, please take a look at this:

Under the graph the number show count of points passed along with mouse event. Below that, coordinates of these points. You can see, on last frame that hovered x value is “5”, and the data contains both points with “5” AND “5,5” x value. Here is jsfiddle

What’s the cause of this behavior? How I can make this more precise? I’d like to get only the values I’m hovering over, which are visually tooltipped. I’d like to get new value ONLY when tooltip changes, and only for available point values.

The problem is that I can’t really predict what kind of data I’m getting with plotly_hover right now, it looks unreliable. If it were continuous hover updating values with every mouse move (pixel by pixel), it would be fine, too.