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

Scroll issue with multiple charts on a page (non-zoomable charts eating scroll events) #289

Closed
ndrake opened this issue Oct 30, 2019 · 7 comments · Fixed by #429
Closed

Comments

@ndrake
Copy link

ndrake commented Oct 30, 2019

I have a screen with multiple Chartjs charts on it. Only one of the charts has zooming/panning enabled. On mobile devices, I'm not able to scroll the page content when my finger is on any of the charts. I was hoping only the zoomable chart would eat scroll events.

I think HammerJS is the culprit, if I don't include it, scrolling is fine (although I can't zoom/pan on mobile).

Here is a CodePen illustrating it:

https://codepen.io/natedrake/pen/LYYzgxb

You can best view the issue by going to the "Full" view on a mobile browser. Notice you can scroll the page on the text content, but on the bottom two charts no scrolling happens.

Consider this issue a feature request or bug report. :) I'm not sure which. Thanks!

@ndrake ndrake changed the title Scroll issue with multiple charts on a page (non-scrollable charts eating scroll events) Scroll issue with multiple charts on a page (non-zoomable charts eating scroll events) Oct 30, 2019
@energy-savesystem
Copy link

Me too. two charts on the screen only on the last one i see scroll events

@jledentu
Copy link
Collaborator

@ndrake Your CodePen actually uses Chart.Zoom.js, not chartjs-plugin-zoom. I guess that this package name was used before, and corresponds to old versions of this plugin.

With https://cdn.jsdelivr.net/npm/[email protected], it works!

I'm closing this issue for now. @energy-savesystem please reopen with a reproducible example if you meet an issue with the current version of chartjs-plugin-zoom. ;)

@energy-savesystem
Copy link

energy-savesystem commented Nov 12, 2019 via email

@ndrake
Copy link
Author

ndrake commented Jan 14, 2020

@jledentu Thanks for the update. I just updated the codepen to use the latest version of the zoom plugin (0.7.5) and I'm still seeing the behavior I described in my original post.

@jledentu
Copy link
Collaborator

@ndrake Mmh you're right, I tested again on my phone and the issue still appears. I'll get a look and try to find a fix.

@jledentu jledentu reopened this Jan 15, 2020
@jledentu
Copy link
Collaborator

I think we should add pinch and pan recognizers in the Hammer manager only when pan and/or zoom are enabled.

@jacopotediosi
Copy link
Contributor

jacopotediosi commented Feb 27, 2021

I have the same problem. I noticed chartjs-plugin-zoom adds "touch-action: none;" to the style attribute of all canvas even for charts that don't implement zoom plugin.

@kurkle kurkle linked a pull request Mar 9, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

4 participants