question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_subplots' or _redrawFromAutoMarginCount undefined using dcc.Loading and dcc.graph

See original GitHub issue

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:

@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
            }
        },

    }


def layout(unresolved_path=None, resolved_path=None):
    return 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")

        ])

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Marc-Andre-Rivetcommented, Oct 16, 2019

Seems worth tracking down the double-rendering issue with dcc.Loading as well, but that can be treated as a separate issue.

https://github.com/plotly/dash-core-components/issues/684

0reactions
Marc-Andre-Rivetcommented, Oct 16, 2019

Closing as fixed by #681

Read more comments on GitHub >

github_iconTop Results From Across the Web

dcc.Loading on First Load Only (Python) - Stack Overflow
Loading generates not only a div, but a parent div for itself. Fortunately, we can access it by using the 'parent_style' property in...
Read more >
Loading | Dash for Python Documentation | Plotly
dcc.Loading. Here's a simple example that wraps the outputs for a couple of Input components in the Loading component. As you can see,...
Read more >
Loading states and Loading component - Dash Python
I have a callback that sometimes takes 3+ seconds to load, so this new component could be quite useful in those cases, but...
Read more >
Loading States | Dash for Python Documentation | Plotly
Getting the loading state of a component and adding a loading component.
Read more >
dcc.Loading for loading graph(s) - Dash Python
I have a dashboard with several dcc.Graph components. Due to the size of the dataframe on which the graphs are built, the graphs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found