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

Minimal step for "drag to zoom" on time chart #317

Closed
krulj opened this issue Jan 29, 2020 · 2 comments
Closed

Minimal step for "drag to zoom" on time chart #317

krulj opened this issue Jan 29, 2020 · 2 comments

Comments

@krulj
Copy link

krulj commented Jan 29, 2020

I am trying to limit "sensitivity" of drag to zoom functionality, more precisely I want to start zooming only when user select at least 2% of chart.

When user clicks on chart and start to drag (in order to zoom in), after releasing mouse button, I need to calculate if user selected just small part of chart (for example below 2% of whole chart):

  • If yes, then chart will not be zoomed
  • If no, then chart will be zoomed as usual

If someone done something similar, I appreciate your help!

@cnojima
Copy link

cnojima commented Apr 13, 2020

I understand that this is an old issue. I'm looking at the same need, i'm toying with a PR at the moment.

If you want a quick, hard-coded fix, change the 0 to > 0 in this line: https://github.com/chartjs/chartjs-plugin-zoom/blob/master/src/plugin.js#L485

2 works well to solve the issue i was trying to handle, other values may fit your use-case better.

If i do submit a PR, it'll be for a new option to set the drag-sensitivity to an integer.

glemiron pushed a commit to glemiron/chartjs-plugin-zoom that referenced this issue May 5, 2020
benmccann pushed a commit that referenced this issue May 5, 2020
@benmccann
Copy link
Collaborator

Closed by #347

ikkala pushed a commit to ikkala/chartjs-plugin-zoom that referenced this issue May 7, 2020
exwm pushed a commit to exwm/chartjs-plugin-zoom that referenced this issue Apr 30, 2021
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

3 participants