Skip to content

Update( ) fails if the user is interacting with the plot #2687

Description

@Watashiku

Hi !

I use an heatmap to represent large datasets. After plotly_relayout events I download and process data (asynchronous, can take some time), then display them. However Plotly will return an undefined error from a promise if the update is done while dragging. I used a setTimeout in the codepen to copy the behavior of my program.

CodePen : https://codepen.io/watashiku/pen/pKJJNW?editors=1010
Error message :

plotly-latest.js:128472 Uncaught TypeError: Cannot read property 'length' of undefined
    at exports.drawData (VM750 plotly-latest.js:128472)
    at Object.lib.syncOrAsync (VM750 plotly-latest.js:119125)
    at relayout (VM750 plotly-latest.js:125433)
    at Object.exports.call (VM750 plotly-latest.js:153164)
    at VM750 plotly-latest.js:133800
    at Object.lib.syncOrAsync (VM750 plotly-latest.js:119125)
    at Object.dragTail [as doneFn] (VM750 plotly-latest.js:133798)
    at HTMLDocument.onDone (VM750 plotly-latest.js:102144)

Steps to reproduce : drag the plot once, then quickly start dragging again and hold it one second - the bug appears if you are dragging during the update triggered by the previous drag.

It creates two major problems :

  • The plot will be "locked" on the screen : panning or zooming will not affect the plot (only the axes in the background),
  • There is no plotly_afterplot event triggered by Plotly which means there is no way for me to tell the user that the plot is ready nor somehow handling the situation by myself (and the error cannot be catched outside of Plotly due to the way it is raise I think?).

Notes :

  • When the bug happens clicking on the graph fixes it
  • The behavior is similar for react, restyle and addtrace. It does not appear with plot (but this creates traces for every relayout)

Activity

  1. alexcjohnson commented on Jun 1, 2018

    @alexcjohnson
    Collaborator

    Looks like the same root issue as #2643, or perhaps #2644. Regardless we clearly need some better solutions for updating a plot that the user may already be interacting with...

  2. Watashiku commented on Jun 5, 2018

    @Watashiku
    Author

    Yes those issues are very similar !

    Is there a way for us to detect when the issue happens until it is fixed ? I did not find a catch case on the promise that fails. The only thing I found is catching all the document.windows error and look for an undefined one 😕

  3. jacobq commented on Jun 26, 2018

    @jacobq

    Is this the same problem I am running into in this example?
    https://codepen.io/jacobq_/pen/KexEEB

    Simply clicking somewhere on the plot area while it's running generates errors like these:
    Uncaught TypeError: Cannot read property '0' of undefined
    (I usually see '0' when clicking and 'length' when dragging / making a zoom-in box)

  4. julesair commented on Oct 25, 2018

    @julesair

    I experience the same error when dragging the plot in my ExtJs application too quickly. The traces are locked, only the axes change. After clicking once on the plot area, it works again as intended.

  5. wenBunny commented on Oct 26, 2018

    @wenBunny

    Friends, I still have this issue...in version 1.41.3. Exact same error, reproduction steps and workaround (click graph and back).

  6. etpinard commented on Dec 3, 2018

    @etpinard
    Contributor

    Merged into #3305

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions