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

TypeError when zooming between datapoints #234

Closed
archdragon opened this issue May 24, 2020 · 7 comments
Closed

TypeError when zooming between datapoints #234

archdragon opened this issue May 24, 2020 · 7 comments
Labels
bug Something isn't working

Comments

@archdragon
Copy link

An error that I've encountered when working on LiveDashboard., but I think it makes more sense to describe it here. :)

Reproduced the error with following versions:

  • v1.0.7
  • v1.0.8
  • Latest master

When trying to zoom in I sometimes encounter:

TypeError: Cannot read property '2' of undefined

Screenshot from the inspector:
image

How to reproduce (with phoenix livedashboard):

As far as I can tell this happens when trying to zoom (by selecting an area with the mouse) and the selected area does not include any datapoints.

  1. Open LiveDashboard
  2. Click metrics -> VM
  3. Wait for a datapoint (or two) to load
  4. Try zooming in in a space between datapoints
@leeoniya
Copy link
Owner

y auto-scaling ain't gonna work when there's nothing in the view to scale by.

you can either prevent zooming to locations with no datapoints by defining a custom scales.x.range or returning some fallback min/max in a custom scales.y.range.

https://jsfiddle.net/x8wsmg2a/

@archdragon
Copy link
Author

Got it, thanks!

@hz2018tv
Copy link

hz2018tv commented May 25, 2020

I am getting those errors too sometimes. Shouldnt fixes go into the uplot lib to benefit all or it is up to each individual caller to make such check? works either way for me though.

getting more of those errors if I use wheel to zoom in/out.

@leeoniya
Copy link
Owner

Shouldnt fixes go into the uplot lib to benefit all or it is up to each individual caller to make such check?

if there is a general solution that makes logical sense, has negligible perf impact, and minimal added core complexity, then definitely.

@hz2018tv
Copy link

agree. just from what I saw, it would make sense that the check happen in the uplot lib before zooming happens, then again, I am not versed enough in javascript to make that judgement, majority of my time were spent in the backend with python on data analysis, sometimes on the fromtend webpage for a change and refreshening.

@leeoniya
Copy link
Owner

leeoniya commented May 25, 2020

this specific case was caused by axis.values customization (and reduction of tick formatter resolution) without a corresponding reduction in axis.incrs resolution.

this is now handled by falling back to the highest-available formatter, which will now likely result in identical tick labels rather than an error.

in most cases it is still preferable to prevent those ticks from being generated by keeping axis.incrs and axis.values resolutions in sync. e.g.: #200 (comment). (cc @danyalejandro)

@hz2018tv i don't know if your situation is related to this, but if you have a repro, i'll certainly take a look.

@leeoniya leeoniya added bug Something isn't working and removed question Further information is requested labels May 25, 2020
@hz2018tv
Copy link

updated to the latest repo, havent seen this error so far. actually I am not sure what triggers it, just noticed that using mouse wheel for zooming did it more, and it is hard for user to check data with mouse movement. thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants