-
-
Notifications
You must be signed in to change notification settings - Fork 143
_subplots' or _redrawFromAutoMarginCount undefined using dcc.Loading and dcc.graph #672
Comments
@renaudl we've been trying to pin down this import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash(__name__)
app.layout = html.Div([
dcc.Dropdown(
id='my-dropdown',
options=[
{'label': 'option1', 'value': 'option1'},
{'label': 'option2', 'value': 'option2'},
],
value='option1'
),
dcc.Loading(
id="loading-chart",
children=[dcc.Graph(id='my-graph-2')],
type="circle"
)
])
@app.callback(Output('my-graph-2', 'figure'),
[Input('my-dropdown', 'value')])
def update_graph(value):
values = [1, 2, 3]
range = [1, 2, 3]
return {
'data': [{
'x': range,
'y': values,
'line': {'width': 1, 'shape': 'spline'}
}],
'layout': {
'margin': {'l': 30, 'r': 20, 'b': 30, 't': 20}
}
}
if __name__ == '__main__':
app.run_server(debug=True) |
Will do, next friday. Thanks. |
What could help us also would be to use an un-minified version of plotly.js. I'm not sure if there's an easy way to do so from dash though. |
Here you go. The error starts to appear when adding the dcc.location and corresponding layout (requiring suppress_callback_exceptions=True). version are:
|
This problem is most likely fixed in plotly.js |
Testing this with both
Modifying usage of
Substituting Logging the The error seems to be in dcc, this promise (https://github.com/plotly/dash-core-components/blob/dev/src/components/Graph.react.js#L93) gets cut short and aborts when the 1st component is unmounted, causing an unploted graph to be purged -- adding a This might be indicative of a deeper rendering problem within the loading component - why are we creating the graph twice? @alexcjohnson @etpinard Will need confirmation as to whether the above diagnostic makes sense from Plotlyjs' perspective. |
Nice detective work @Marc-Andre-Rivet - now we're getting somewhere!
If you mean If you mean Seems worth tracking down the double-rendering issue with |
From what I can tell, |
|
Hmm OK, let's protect the |
Maybe this happens because the element does not exist anymore by the time the purge gets to it (unmount)? The stack indicated this was happening in a promise. |
Closing as fixed by #681 |
Uh oh!
There was an error while loading. Please reload this page.
Hi All,
I have console error message when the graph loads. With a simple scenario as code shows below, I get this error:
plotly-1.49.4.min.js:7 Uncaught (in promise) TypeError: Cannot read property '_subplots' of undefined
at plotly-1.49.4.min.js:7
at Object.r.drawFramework (plotly-1.49.4.min.js:7)
at e (plotly-1.49.4.min.js:7)
at Object.l.syncOrAsync (plotly-1.49.4.min.js:7)
at i (plotly-1.49.4.min.js:7)
if I set the figure to {} or to {layout:{}} then I get a warning (which is good) and the following error:
plotly-1.49.4.min.js:7 Uncaught (in promise) TypeError: Cannot read property '_redrawFromAutoMarginCount' of undefined
at C (plotly-1.49.4.min.js:7)
at plotly-1.49.4.min.js:7
Here sample code:
The text was updated successfully, but these errors were encountered: