I love the new hoveranywhere and clickanywhere functionality introduced in #7707!
To make this even better for use with Dash, I'd like to propose two updates:
-
Include xPixel and yPixel in the hoveranywhere data. This would make it possible to create a bounding box for use with a custom tooltip using dcc.Tooltip.
-
Emit an unhover event after the cursor leaves the plot area. This would prevent stale hover information from being returned in a Dash callback.
Here is a sample app from my Dash PR, "Enable callbacks in Plotly hoveranywhere and clickanywhere": plotly/dash#3852
The first image was captured while hovering over a point. Notice that xPixel and yPixel are included.
The second image was captured when not hovering over a point. xPixel and yPixel are not available because they are only included with point data. Also, this image was captured after the mouse left the plot area. The stale hoveranywhere data is still included in the callback.

I love the new
hoveranywhereandclickanywherefunctionality introduced in #7707!To make this even better for use with Dash, I'd like to propose two updates:
Include
xPixelandyPixelin thehoveranywheredata. This would make it possible to create a bounding box for use with a custom tooltip usingdcc.Tooltip.Emit an
unhoverevent after the cursor leaves the plot area. This would prevent stale hover information from being returned in a Dash callback.Here is a sample app from my Dash PR, "Enable callbacks in Plotly hoveranywhere and clickanywhere": plotly/dash#3852
The first image was captured while hovering over a point. Notice that
xPixelandyPixelare included.The second image was captured when not hovering over a point.
xPixelandyPixelare not available because they are only included with point data. Also, this image was captured after the mouse left the plot area. The stalehoveranywheredata is still included in the callback.