question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No x-axis pan or zoom using Chart.js 2.6.0

See original GitHub issue

chartjs-plugin-zoom seems to have some problems in conjunction with Chart.js 2.6.0: In my case, I cannot pan or zoom on the x-axis.

When I simply run npm install chart.js@2.5.0 x-axis panning and zooming starts working again immediately. Running npm install chart.js@2.6.0 breaks x-axis pan&zoom again. So it looks like a problem with the chart.js version.

Are you experiencing the same problems or is this working for you? Any ideas what I can do to upgrade to the latest version of chartjs-plugin-zoom (it has 2.6.0 as dependency)? Please help.

In my config I use:

pan: {
   enabled: true,
   mode: 'xy',
   rangeMin: {
     x: null,
     y: null
   },
   rangeMax: {
     x: null,
     y: null
   }
 },
 zoom: {
   enabled: true,
   mode: 'xy',
 }

Enviroment:

  • Ionic 3.5.3
  • ng2-charts 1.6.0

Edit: Chart-type: time

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:36 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
hilljh82commented, Aug 2, 2017

I had the same problem with time x axis. After some investigation, it seems that firstTick and lastTick is no longer available on the ChartElement object. Instead, the pan function for time needs to manually index into the ticks array to get both firstTick and lastTick. I am working on a patch, and will test if this solves the problems for 2.6.0.

3reactions
jarrodbellcommented, Sep 21, 2017

Also, figured out why the axis ticks were not updating when zooming in - the ticks are being built before the options.time.min and max are taken into account.

Editing the release build of Chart.js “buildTicks” (line ~13844) function to move the following lines:

// Enforce limits with user min/max options
min = parse(timeOpts.min, me) || min;
max = parse(timeOpts.max, me) || max;

Just after this one:

var timeOpts = options.time;

Then the ticks update as you would expect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chartjs-plugin-zoom plugin does not change x axis labels
js module in order to plot some data and am using the chartjs-plugin-zoom in order to enable zooming and panning however although the...
Read more >
Options | chartjs-plugin-zoom
A zoom and pan plugin for Chart.js >= 3.0.0. ... The options are split in three sub-objects, limits, pan and zoom.
Read more >
Chartjs-Plugin-Zoom Plugin Does Not Change X ... - ADocLib
Plugin that enables zoom and pan functionality in Chart.js charts. Panning can be done via the mouse or with a finger. Zooming is...
Read more >
chartjs-plugin-zoom - npm
Plugin that enables zoom and pan functionality in Chart.js charts.. Latest version: 2.0.0, last published: a month ago.
Read more >
chartjs zoom, chartjs highlight range, chart js datepicker, chart ...
chartjs -plugin-zoom. A zoom and pan plugin for Chart.js. Currently requires Chart.js >= 2.6.0. Panning can be done via the mouse or with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found