Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Watashiku opened this issue May 31, 2018 · 6 comments
Closed

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

Watashiku opened this issue May 31, 2018 · 6 comments

Comments

@Watashiku
Copy link

Watashiku commented May 31, 2018

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)
@alexcjohnson
Copy link
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...

@Watashiku
Copy link
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 😕

@jacobq
Copy link

jacobq commented Jun 26, 2018

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)

jacobq added a commit to jacobq/plotly.js that referenced this issue Jun 27, 2018
* In drawData
* In supplyDefaultsUpdateCalc
jacobq added a commit to jacobq/plotly.js that referenced this issue Jun 27, 2018
* In drawData
* In supplyDefaultsUpdateCalc
jacobq added a commit to jacobq/plotly.js that referenced this issue Jun 27, 2018
* In drawData
* In supplyDefaultsUpdateCalc
@julesair
Copy link

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.

@wenBunny
Copy link

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

@etpinard
Copy link
Contributor

etpinard commented Dec 3, 2018

Merged into #3305

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants