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:
HTML
<div id="tester" style="width:600px;height:250px;"></div>
JS
$(document).ready(function(){
var tester = $('#tester');
tester.on('plotly_hover', function(data){
console.log(data)
});
Plotly.plot( 'tester', [{
x: [1, 2, 3, 4, 5],
y: [1, 2, 4, 8, 16] }], {
margin: { t: 0 } } );
})
See this fiddle in order to try it yourself: https://jsfiddle.net/c1kt3r82/158/
What am I doing wrong?