Hi !
I’m currently facing a little problem with Plot.react Plot.update.
The problem is, I want to update my plot (which is a scatterGL plot, by the way) with more or less points (depending on a check box checked by the user). But Plot.react and Plot.update both destroy the div where the plot is in, and this has, as a result, put all the other buttons below the plot on it.
Here is what I’m talking about (I can’t show the whole plot, but you get the idea) :
When I’m using this : Plot.purge followed by Plot.newPlot, this works like a charm.
Here is the code I’ve implemented :
graphic = document.getElementById('graphic');
//if the graph is already display, we'll re-draw on the same graphic. It'll eat less resources
if (IS_CREATED) {
Plotly.purge(graphic); //THIS IS A BAD FIX.
Plotly.newPlot(graphic, [{
x: X,
y: Y,
mode: 'markers',
marker: {
size: 3,
color: color_value,
colorscale: color_scale
},
type: 'scattergl',
hoverinfo: 'none' //to hide labels on points
}], layout, {responsive: true});
return;
}
How is it possible to use Plot.react/update without destroying the div ?
Thanks a lot !