Black Lives Matter. Please consider donating to Black Girls Code today.

Got a different hover eventData

Hi all,

I got different hover eventData in two plot but I don’t why it becomes different like that.
Here’s the link for jsfiddle example:

(I did console.log() on the eventData in the two graphs)
The ouptut are:
graph1: w.Event {type: “plotly_hover”, timeStamp: 1523353721390, jQuery33107572314871015291: true, isTrigger: 3, namespace: “”, …}
graph2:{event: MouseEvent, points: Array(1), xaxes: Array(1), yaxes: Array(1), xvals: Array(1), …}

On the first graph, your selecting the graph’s div using jQuery (var myPlot = $("#plotly");) and hence listening to a jQuery event whereas on the second graph you’re using a native getElementById

1 Like

It works, thanks a lot

Hi, I got a corresponding problem on that.
Is it possible to get the plotly event data out of the eventData of the jquery object (graph1 in this case)?

It may also help, if there is a possibility to somehow else implement plotly hover inside the jquery ready.

i tried this:

(document).ready(function() { (’#box3’).on(‘plotly_hover’, function(){

    document.getElementById('box3').on('plotly_hover', function(eventdata) {
        let a = eventdata.points[0].pointIndex;

        let graphDiv = document.getElementById('box2');

        Plotly.restyle(graphDiv, {'visible':true}, a+2)

But it gives me a load of eventListeners so the handler overflows.

Thanks for your help in advance! :slight_smile: