-
-
Notifications
You must be signed in to change notification settings - Fork 143
TypeError: r.*.destroy is not a function #313
Comments
Can you set If you can't share the code, maybe try to make a minimal example showing the behavior. |
Thanks! I have now enabled the options you suggested, and will update this issue when I manage to capture this issue again (it's quite intermittent, which is also why I've had difficulty creating a reproducible example). |
Have managed to trigger it again.
Images from formatted plotly.js for the top few frames in the stack trace: |
Turns out this was actually very easy to reproduce - it seems like any figure containing Scattergl traces and a variable subplot layout will cause this issue. In the app below, moving any sliders will cause the figure to crash. Using import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from plotly import tools
import random
app = dash.Dash()
sx = dcc.Slider(id='sx', min=1, max=5, value=1)
sy = dcc.Slider(id='sy', min=1, max=5, value=1)
app.layout = html.Div(children=[
sx, sy,
dcc.Graph(
id='graph',
)
])
@app.callback(
Output('graph', 'figure'),
[Input('sx', 'value'),
Input('sy', 'value')]
)
def callback(nx, ny):
fig = tools.make_subplots(ny, nx)
for ix in range(nx):
for iy in range(ny):
fig.add_scattergl(x=[random.random() for i in range(20)],
y=[random.random() for i in range(20)],
mode='markers',
row=iy+1, col=ix+1)
return fig
if __name__ == '__main__':
app.scripts.config.serve_locally = True
app.run_server(debug=True) Versions:
|
For further info, the issue is still present when updating to:
And for more interest, when the figure starts throwing errors and stops responding, you can sometimes coax the plot back into life by double clicking on a subplot and then clicking on a slider to redraw with the same layout - but it can end up looking pretty funky (see below)! It also generally seems to be more likely to work when reducing the number of subplots instead of increasing. |
Fixed in plotly.js 1.42.0 |
I've recently updated all my Dash/Plotly depenendices to their latest versions:
I have a Dash app where the number and layout of subplots in one of my figures (consisting of lots of Scattergl traces) changes depending on user inputs. When the number/layout of subplots changes, sometimes I get the following errors in the Chrome console:

After this, the subplots seem to be drawn incorrectly (missing elements, incorrect sizes). If I trigger another redraw after this happens the figure is eventually drawn correctly. Unfortunately I can't share the app code but will see if I can reproduce it.
I was previously on the following, and had never seen this issue before (although despite this problem, in general drawing performance with my Dash apps is a lot better now):
The text was updated successfully, but these errors were encountered: