My hover over info box works fine until I replot data after updating the data array with
Plotly.newPlot(‘graph’, data, layout, {displayModeBar: false});
my code outline:
var data = [data1, data2, data3, data4];
var hoverInfo = document.getElementById(‘hoverinfo’);
var myPlot = document.getElementById(‘graph’);
Plotly.newPlot(‘graph’, data, layout, {displayModeBar: false});
myPlot.on(‘plotly_hover’, function(data){
…my hover stuff…
});
I can’t find a way of using Plotly.restyle to update the entire data array.
I tried this which looks like it should work. It changes things but breaks the graph completely.
Plotly.restyle('graph', data1, [0]);
Plotly.restyle('graph', data2, [1]);
Plotly.restyle('graph', data3, [2]);
Plotly.restyle('graph', data4, [3]);