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

Panning Broken with Chart.js 2.9.0 #279

Closed
exwm opened this issue Oct 26, 2019 · 2 comments · Fixed by chartjs/Chart.js#6608
Closed

Panning Broken with Chart.js 2.9.0 #279

exwm opened this issue Oct 26, 2019 · 2 comments · Fixed by chartjs/Chart.js#6608

Comments

@exwm
Copy link

exwm commented Oct 26, 2019

With the latest chart.js v2.9.0 the scale.getValueForPixel method has been changed and its use in chartjs-plugin-zoom (tested with v0.7.4) causes misbehavior of pan with numerical scales and possibly others. Specifically, panning causes the chart to zoom. Exactly one of either the start or end of the scale remains fixed while the other stretches outwards.

The panNumericalScale function in chartjs-plugin-zoom uses scale.getValueForPixel to get the new minimum and maximum values for the scale (see

var newMin = scale.getValueForPixel(scale.getPixelForValue(prevStart) - delta);
).

I believe the changes that are causing this issue were made in this commit of chart.js: chartjs/Chart.js@cbace1c#diff-f0d8f86fecab28f396793911b0e9f36dR746.

A demonstration of the bug can be found here: https://codepen.io/exwm/pen/vYYZREw. Simply pan the chart by dragging with the mouse.

@benmccann
Copy link
Collaborator

FYI @kurkle. Maybe a bug in handling reverse support in core.scale

@etimberg
Copy link
Member

Chart.js v2.9.1 has been released with a fix for 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.

3 participants