HoverEvent: how to distinguish mouse move in and out?

Hello, I have a scatter plot.

I utilize callback functions on hover_data. When the cursor moves to a specific data point, we change its color. When the cursor leaves the data point, the color of the point should be resumed.

hover_data can give me the index of the data point, so that I can change the color.

However, how to distinguish the mouse moving in and out behavior?

I recorded the index of the points, e.g., index of the current hover, and index of the previous hover. It works. But when I move the mouse quickly, the color may not be resumed.

Hello @irecsys,

Have you tried using css instead? Should be much quicker.