-
Notifications
You must be signed in to change notification settings - Fork 325
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
Zoom can be trigger outside of chart region #611
Comments
subscribing |
I have the same issue, we can zoom outside of data, on yaxis and xaxis legend |
To fix #256 "Zoom triggered when hiding/showing series by clicking legend", I have created PR #772 "Don't trigger the zoom on legends area". So, it has currently been limited to prevent zoom starting only when mouseDown happens in legends area. What do people (including @kurkle) think, should I change the implementation to actually check if mouseDown happens in chartArea? |
If zoomable only along x-axis, it's goofy to allow drag zoom in the y-axis label area (in addition to the legends area). But allowing drag zoom in the x-axis label area is perfectly fine. So maybe chartArea + related axis label area(s)? |
Hi,
I am using
[email protected]
and[email protected]
.I found that it is possible to zoom outside of chart data region.
For example, I can zoom on legend / y-axis even if there is no data in this region.
See bellow screen capture:
I have following zoom plugin configuration:
I can provide
limits
configuration, which helps.But it is still possible to highlight legend / y-axis and trigger zoom with unwanted data.
I did not find any related issue on this git repository or on stackoverflow.com.
Is there any way to prevent zooming outside of data region ?
EDIT:
Looking deeper at the library code, I may have found the root cause of this "bug".
In
chartjs-plugin-zoom/src/handlers.js
Lines 67 to 83 in bb6dee3
Variables,
left
/right
/top
/bottom
are overridden ifxEnabled
or / andyEnabled
.Code should be:
Changing above lines fix the issue on local workspace. But I do not know if there is other impact changing this.
I can provide PR if anyone wants 😄
The text was updated successfully, but these errors were encountered: