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!

Take each mouse x / y on the graph

I used a code like this to take the values ​​x and y mouse from the chart.

$(’#’+“myDiv”).bind(‘plotly_relayout’,
function(event,eventdata){
alert( ‘ZOOM!’ + ‘\n\n’ +
‘Event data:’ + ‘\n’ +
JSON.stringify(eventdata) + ‘\n\n’ +
‘x-axis start:’ + eventdata[‘xaxis.range[0]’] + ‘\n’ +
‘x-axis end:’ + eventdata[‘xaxis.range[1]’] );
});

I need to take ( using hover ) all mouse values ​​x / y in any point of the graph .
If I try to use the same code , but using " plotly_hover " , I get this error : " Uncaught TypeError : Converting circular structure to JSON ".
I solved the problem , but the x / y values ​​are always referred only to candles (I have a candlestick chart ) .
I tried it with a similar solution :
myPlot.on ( ’ plotly_hover ’ , function ( xaxis ) { blah blah } ) ;
but it does not work.
How can I do to take the mouse values ​​x / y in the graph ( and not only those referring to candles ) ?

https://plot.ly/javascript/hover-events/ is a good place to start.

Let me know if you’re looking for something more specific.