Skip to content

Cannot read property _subplot of undefined #4157

Description

@acrhg

I have a dashboard with several tabs and charts/tables. The tab that renders on initial page load has an array of five gauge charts (pie charts cut in half with a hole and a line drawn for an indicator) at the top. It looks like this:
Foo

Occasionally, one of the charts will not render, like this:
Bar

Here is the error I get in the console:

Bar

Original post is here. I know this is the part of dash framework but I think something it has to do with the plotly.js. Any help would be really appreciated. Thanks

Activity

  1. etpinard commented on Aug 29, 2019

    @etpinard
    Contributor

    Thanks for posting!

    It is indeed an error coming from plotly.js.

    The first step in debugging would to convert your example into pure plotly.js. Maybe someone could help us out?

  2. etpinard commented on Sep 26, 2019

    @etpinard
    Contributor

    I wasn't able to replicate the problem when adapting the python code provided in https://community.plot.ly/t/chart-randomly-does-not-render/27978 in JS in a codepen.

    Closing due to lack of reproducible example.

  3. slishak commented on Oct 1, 2019

    @slishak

    I know it doesn't help much, but for the record I have also been experiencing this issue for a while. I've so far also been unable to create a reproducible example, but it appears to be caused by repeatedly redrawing a Plotly graph in Dash. I've usually only see it after working with an app for a while and redrawing a plot 20-30 times with different data and layouts, eventually it will throw this error and stop updating until the page is refreshed. Anecdotally it seems to happen most often when I change the layout (e.g. number of subplots). I think it's related to Dash re-using some of the resources from the existing canvas when drawing an updated figure?

  4. alexcjohnson commented on Oct 4, 2019

    @alexcjohnson
    Collaborator
  5. etpinard commented on Oct 4, 2019

    @etpinard
    Contributor

    Ok - reopening.

  6. etpinard commented on Oct 10, 2019

    @etpinard
    Contributor

    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.

  7. etpinard commented on Oct 10, 2019

    @etpinard
    Contributor

    Ok I'm able to reproduce the Cannot read _subplot of undefined bug using:

        fit('should not attempt to rehover over exiting subplots', function(done) {
            var data = [
                {y: [1], hoverinfo: 'y'},
                {y: [2], hoverinfo: 'y', xaxis: 'x2', yaxis: 'y2'}
            ];
    
            var data2 = [
                {y: [1], hoverinfo: 'y'}
            ];
    
            var layout = {
                xaxis: {domain: [0, 0.5]},
                xaxis2: {anchor: 'y2', domain: [0.5, 1]},
                yaxis2: {anchor: 'x2'},
                width: 400,
                height: 200,
                margin: {l: 0, t: 0, r: 0, b: 0},
                showlegend: false
            };
    
            var gd = createGraphDiv();
    
            Plotly.react(gd, data, layout)
            .then(function() {
                assertLabelsCorrect([300, 100], [303, 100], '2', 'after 1st draw');
            })
            .then(function() {
                var promise = Plotly.react(gd, data2, layout)
                assertLabelsCorrect([300, 100], [303, 100], '2', 'before 2nd react() resolves');
                return promise;
            })
            .catch(failTest)
            .then(done);
        });

    That is, by hovering over a subplot that's in the process of getting removed.

    We'll release a patch fixing this problem in next week's v1.50.1. I'm not sure if that will fix every Cannot read _subplot of undefined issue, but it should be a step in the right direction.

  8. self-assigned this
    on Oct 10, 2019
  9. renaudl commented on Oct 16, 2019

    @renaudl

    Anther reproduction here:
    plotly/dash-core-components#672

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions