plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

'r.scatter2d.destroy is not a function' error when updating a plot using scattergl and Plotly.react

Open rhamner opened this issue 8 years ago • 8 comments

I am getting

'Uncaught TypeError: r.scatter2d.destroy is not a function at Object.E.e._scene.r.destroy (plotly.min.js:7) at Object.r.clean (plotly.min.js:7) at Object.v.cleanPlot (plotly.min.js:7) at e (plotly.min.js:7) at Object.l.syncOrAsync (plotly.min.js:7) at r.plot (plotly.min.js:7) at Object.l.syncOrAsync (plotly.min.js:7) at Object.r.react (plotly.min.js:7)'

when trying to update a plot with new data using Plotly.react. I have a codepen that reproduces it:

https://codepen.io/rhamner/pen/GXdzLg

What should happen in the codepen is:

  • first plot shows data set 2
  • second plot shows data set 1 for 5 seconds, then data set 2, then data set 1 again

Instead, it stays on data set 1 and throws the error above. I thought at first data set 2 was bad, but the first plot seems to work just fine and it's identical data. Further, after throwing that error, even trying to plot the original data seems to fail.

Switching to Plotly.newPlot seems to work fine, but it's quite slow so I would really like to avoid that.

This is plotly.js 1.40.1 and I am using chrome. It also happens with firefox for me.

rhamner avatar Sep 13 '18 03:09 rhamner

Hmm. I can't replicate. I don't see any console errors.

etpinard avatar Sep 13 '18 18:09 etpinard

Plotly.js 1.41.1 and also using the react() API. I also have this error. I can only reproduce it on Windows. Not quite sure on the trigger, but I only get it when plotting a large number of points (100k) with 'scattergl' along with some other plots.

EDIT: Just confirmed that you can avoid this bug by using 'scatter' instead of 'scattergl'

For my particular reproduction case with my App: No error with:

  • Linux Firefox 62.0
  • Linux Chrome 69.0.3497.100

Error with:

  • Windows Firefox 62.0
  • Windows Chrome 69.0.3497.100

arlowhite avatar Sep 18 '18 23:09 arlowhite

It reproduces on 3 of 5 machines I've tried it on. All are windows machines, so I'm not sure what the difference is on the two that don't show the error.

I forgot to note in the original post...I do not get it on the opening draw in the codepen link. I have to let it draw, then click run again to get the error.

As arlowhite noted, using 'scatter' instead of 'scattergl' avoids it. Like newplot though, scatter is very slow for large amounts of data for me so I would like to avoid it.

rhamner avatar Sep 19 '18 01:09 rhamner

@antoinerg can you try this out on Windows? Thanks!

etpinard avatar Sep 19 '18 13:09 etpinard

This bug appeared when i updated from 1.38.1 to 1.41.1. Tested on two mashines using Chrome 69.0.3497.100 and linux Ubuntu 18.04. Bug appears when changing layout and calling Plotly.react.

mikk351 avatar Sep 20 '18 13:09 mikk351

Bug appears when changing layout and calling Plotly.react.

Can you be more specific? Could share a minimal reproducible example in a codepen to help us out?

etpinard avatar Oct 05 '18 16:10 etpinard

The Dash app here can reliably reproduce this issue: https://github.com/plotly/dash-core-components/issues/313#issuecomment-431008485. Also potentially related to https://github.com/plotly/plotly.js/issues/2999?

slishak avatar Oct 24 '18 12:10 slishak

Most likely a duplicate of https://github.com/plotly/plotly.js/issues/2999 and thus most likely solved in https://github.com/plotly/plotly.js/pull/3132

etpinard avatar Oct 24 '18 20:10 etpinard