Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Plotly fires no unhover event if I supress value-annotations

Hello,
I created a jsFiddle-Example for showing that problem: https://jsfiddle.net/473z6Lbx/3/

My goal is to use the plotly_hover and plotly_unhover events to show the associated values in my own way.
Additionally I want to disable the value-annotation that appears in plot if you move the mouse.

But I can’t use “hovermode: false” (row 18) in layout because then the mentioned events will not be fired by plotly.
I thought the row 31 could be a workaround: Plotly.Fx.hover(myDiagramElement, []);
But If I use this in plotly_hover-Event the plotly_unhover-Event will not be fired.

Anybody have another idea to hide the value-annotations or other solutions?

Aah… the solution is easy! It is possible to diable the tooltips/value-annotations with the hoverinfo: 'none' as you can see in my updated js fiddle in line 8 and 16: https://jsfiddle.net/473z6Lbx/4/

var trace1 =
{
  x: [1, 2, 3],
  y: [40, 50, 60],
  name: 'data1',
  type: 'scatter',
  hoverinfo: 'none'
};

And the hover and unhover events will works too as see in the reference: https://plot.ly/javascript/reference/#scatter-hoverinfo

hoverinfo (flaglist string)
Any combination of “x”, “y”, “z”, “text”, “name” joined with a “+” OR “all” or “none” or “skip”.
examples: “x”, “y”, “x+y”, “x+y+z”, "all"
default: "all"
Determines which trace information appear on hover. If none or skip are set, no information is displayed upon hovering. But, if none is set, click and hover events are still fired.

1 Like

Hiya! Plotly now has improved and consolidated Plotly.js event documentation here:

Please feel free to suggest documentation improvements in a pull request:

https://github.com/plotly/documentation/tree/source-design-merge/_posts/plotly_js/events