chartjs / chartjs/chartjs-plugin-zoom

Feature Request: add ability to limit upper and lower bounds of min an max scale values independently

Open
#768 3 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
623
Forks
331
Avg merge
7h 5m
Merged PRs (30d)
7

Description

Hello,

First off, thanks for the plugin, super awesome. :tophat:
I'm using the latest (as of 06-11-23) from [cdn.jsdelivr](https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom) for both chart.js and the plugin.

The idea here is to fix (or limit) an axis value and have the zoom affect the data scale in a separately controllable fashion. For example; say we have a dataset that extends away from 0 and we want to zoom keeping 0 in view.

Currently we have:
``` javascript
limits: {
y: {
min: 'original'|value,
max: 'original'|value',
minRange: value
}
}
```
I purpose the following:
``` javascript
limits: {
y: {
min: 'original'|value,
max: 'original'|value,
minRange: value,
maxMin: 'original'|value,
minMax: 'original'|value
}
}
```
Where:
`minMax` sets the *maximum* value that the `min` scale could take under zoom.
`maxMin` sets the *minimum* value that the `max` scale could take under zoom.
Setting to `original` would have the standard implications. Now, if both `min` and `minMax` were set to `original`, that would disable changes to that scale value under zoom.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.