chartjs/chartjs-plugin-zoom

Feature request: Add maxRange option

iliubinskii opened this issue · 2 comments

Hi,

You already have minRange option hear:

export interface ScaleLimits {
  min?: number | 'original';
  max?: number | 'original';
  minRange?: number;
}

I see the reason why you didn't add maxRange. This is because you assumed that user starts from seeing all the data. So, there is no reason to limit him in returning to this initial state.

However, chart.js has min/max options:

  scales: {
    x: { min: 0, max: 20 },
    y: { min: 0, max: 100 }
  }

In this case the chart will start from showing 20 points, even if data contains 10000 points.

Then I may want to zoom in to 10 points at most and to zoom out to 1000 points at most.
I may use minRange range for the first (10 points min).
And I could use maxRange for the second (1000 points max).

Thank you for great plugin!

ilyub commented

I reloaded submitted form several times because I was getting error from GitHub. And it appears that I actually created several duplicate tickets. Already closed duplicates. Sorry.

kurkle commented

I guess nobody wanted to limit the maxRange below min/max before. Sounds like a reasonable addition to me.