Hover event does not contain points

Hi,

I need the x-axis values, when hovering over my plotly chart. According to the plotly docs (https://plot.ly/javascript/hover-events/) the hover event callback should contain the field “points” from which I should get the x value.

But if you look at this basic example you can see that the callback does not contain the field “points”. Also other fields like “data” are undefined:
https://jsfiddle.net/c1kt3r82/158/

What am I doing wrong? :slight_smile:

Thanks in advance,
Max

See https://jsfiddle.net/c1kt3r82/159/

Using jQuery syntax, the first argument in the event callback is the jQuery event object, the second is the plotly event data:

 tester.on('plotly_hover', function(_, data){
  	console.log(data)
  });

should work as intended.

2 Likes

Awesome, thank you, Etienne!
That saved my day :+1: