Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

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

Closed
@renaudl

Description

@renaudl

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")

        ])

Metadata

Metadata

Labels

dash-type-bugSomething isn't working as intended

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions