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

Can't detect zoom selection in progress event (mousedown) #469

Closed
vicatcu opened this issue Apr 24, 2016 · 4 comments
Closed

Can't detect zoom selection in progress event (mousedown) #469

vicatcu opened this issue Apr 24, 2016 · 4 comments
Labels
bug something broken

Comments

@vicatcu
Copy link

vicatcu commented Apr 24, 2016

I'm trying to make a "realtime" (updates ever 5 - 10 seconds) application where I use setTimout to update traces and call Plotly.newPlot on the target div. If I happen to be in the midst of using the zoom controls when the timer executes, I get some exceptions in the console the first of which is "Uncaught (in promise)" once while keeping my mouse clicked in a zoom selection state. Then when I release the mouse button completing my zoom selection, I get "Cannot read property 'xaxis' of undefined" once, then "Uncaught TypeError: Cannot read property '_plots' of undefined" a few dozen times (56), then "Uncaught TypeError: Cannot read property '_hoverlayer' of undefined" once.

This originates within plotly.js, and I can provide traces from the non-minified source, I think this is pretty easy to reproduce. I was thinking if I could capture "begin zoom selection" and "end zoom selection" events then I could guard against calling Plotly.newPlot when a user is in the middle of a zoom selection, but I couldn't figure out / find any documentation of that event being registered by the library.

Is this an omission, or did I just miss it in my research? Is there a known workaround? I guess a trivial workaround would be to surround the call to Plotly.newPlot in a try/catch block, but that seems a bit heavy handed... scratch that, surrounding in try/catch has no effect, I guess due to an asynchronous nature.

@mdtusz
Copy link
Contributor

mdtusz commented Apr 25, 2016

Depending on what you're doing, you may want to use Plotly.addTraces, Plotly.relayout or one of the other Plotly.____ methods rather than Plotly.newPlot as newPlot creates a brand new plot.

That said, this is indeed a bug and it applies to the other methods listed above as well. Thanks for reporting!

Example here.

@mdtusz mdtusz added the bug something broken label Apr 25, 2016
@tomwhoiscontrary
Copy link

I also see Uncaught (in promise) undefined while zooming on a chart while getting live updates.

Is there any consequence of this bug other than annoying log messages? Will the plotting be wrong? Is there anything i should do to correct it?

@cms26
Copy link

cms26 commented Aug 25, 2017

I'm also running into this issue. The example link in the previous comment seems to be broken.

If you mousedown on the plot in the example below you will see the errors in the chrome console. For whatever reason they do not show up in the codepen console.

Example

@etpinard
Copy link
Contributor

Merging into #3305

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

No branches or pull requests

5 participants