You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plotly_beforehover event can be used to prevent hover effects dynamically, by attaching a handler that returns false if you don't want the hover label. But it has two shortcomings:
It doesn't include info about which point(s) were going to get a label, only the mouse event. If we move this event to after the hover data has been calculated but before the labels have been displayed, we should be able to fix this.
The ideal fix would be to make the event data match most of our other events, and include the plotly data and the mouse event inside one object. But if we did this now, it would be a breaking change. Do we think this is acceptable? I don't see what useful thing people would do with the mouse event by itself, so I wouldn't be too worried about this, but it is a breaking change.
@n-riesco suggests an alternative: we could fire this event after gd._hoverdata has been set, so the handler can inspect it, and then if the handler returns false we reset gd._hoverdata to what it was before (or just clear it?) Perhaps this would be a safer way to do it, then switch to ^^ in v2?
If you attach multiple handlers, only the return value of the last one will be used. This is both limiting and potentially dangerous (if your app can possibly attach handlers in unknown order) Can we change to pass on the && of any of these handlers returning false? (ie undefined and other falsey values should not count as false if we do this, only false itself).
The
plotly_beforehover
event can be used to prevent hover effects dynamically, by attaching a handler that returnsfalse
if you don't want the hover label. But it has two shortcomings:gd._hoverdata
has been set, so the handler can inspect it, and then if the handler returnsfalse
we resetgd._hoverdata
to what it was before (or just clear it?) Perhaps this would be a safer way to do it, then switch to ^^ in v2?&&
of any of these handlers returningfalse
? (ieundefined
and other falsey values should not count asfalse
if we do this, onlyfalse
itself).@etpinard thoughts?
The text was updated successfully, but these errors were encountered: