-
Notifications
You must be signed in to change notification settings - Fork 327
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
Fix zoom outside of chart area #811
Conversation
Hi @kurkle, |
Hi @gopal-panigrahi |
Hi @zloveless, |
Thanks! I found some code in one of the tracking issues on this here... I just used added a callback to onZoomStart() to check if the zoom action is in the chart area. I still wish one of these PR's that fix it would get merged. |
Thanks for working on this, @gopal-panigrahi. I'm curious about the changes in d9fd526 - to me, the behavior feels cleaner without this change (letting the drag rectangle pin to the edges of the chart area, instead of the edges of the canvas). Were there specific issues that you ran into, or is it more of a UX preference? |
Hi @joshkel , If we enable zoom for only chart area then we can pin the drag rectangle to the edges of chart area. |
@gopal-panigrahi I believe it will fix an issue I'm having where if I start zooming into one chart but end the drag in another chart, the zoom behaviour is all messed up. However I don't think this repo is alive anymore, would it be possible to apply this PR here - https://github.com/trullock/chartjs-plugin-zoom |
Hi @kurkle , |
Hi @gopal-panigrahi, and than you for the PR. I'm not sure if the ownerDocument works for all use cases, maybe there should be an option to enable this? |
Hi @kurkle ,
With boundary fixed to chartArea: https://jsbin.com/doxidebene/1/edit?js,output, Try creating drag rectangle at across the axis to chartArea With boundary fixed to canvasArea: https://jsbin.com/vunezavomu/1/edit?js,output |
Thanks! |
I had written getPointPosition function specifically for endPoint outside of canvas area. code sample : https://jsbin.com/culesidobe/1/edit?html,output screen-capture.webm |
Fix: #770
Fix: #807
Changes:
mousemove
event tocanvas.ownerDocument
for calculating drag rectangle even when cursor is outside the chart area.clientX/Y - chartArea.left/top