You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Minor formatting, code cleanup, spelling fixes
* Allow configuring limits for individual axes
Fixes#522.
* Allow using original axis as zoom limits
Fixes#523.
* Handle autoscaled min/max
* Fix resetZoom
This should fix test failures.
* Retrieve chart state within updateRange
This lets us keep the `zoomFunctions` and `panFunctions` signatures unchanged, since they're part of the public API.
* Revise state management
As discussed in code review, it seems cleaner to consistently get state at the start of a function then pass it to `storeOriginalScaleLimits`.
| `modifierKey` | `'ctrl'`\|`'alt'`\|`'shift'`\|`'meta'` | `null` | Modifier key required for panning with mouse
38
38
| `overScaleMode` | `'x'`\|`'y'`\|`'xy'` | `undefined` | Which of the enabled panning directions should only be available when the mouse cursor is over a scale for that axis
39
-
| `threshold` | `number` | `10` | Mimimal pan distance required before actually applying pan
39
+
| `threshold` | `number` | `10` | Minimal pan distance required before actually applying pan
40
40
41
41
### Pan Events
42
42
@@ -103,10 +103,42 @@ Limits options define the limits per axis for pan and zoom.
103
103
| `x` | [`ScaleLimits`](#scale-limits) | Limits for x-axis
104
104
| `y` | [`ScaleLimits`](#scale-limits) | Limits for y-axis
105
105
106
+
If you're using multiple or custom axes (scales), you can define limits for those, too.
107
+
108
+
```js
109
+
constchart=newChart('id', {
110
+
type:'line',
111
+
data: {},
112
+
options: {
113
+
scales: {
114
+
y: {
115
+
min:20,
116
+
max:80,
117
+
},
118
+
y2: {
119
+
position:'right',
120
+
min:-5,
121
+
max:5
122
+
}
123
+
},
124
+
plugins: {
125
+
zoom: {
126
+
limits: {
127
+
y: {min:0, max:100},
128
+
y2: {min:-5, max:5}
129
+
},
130
+
}
131
+
}
132
+
}
133
+
});
134
+
```
135
+
106
136
#### Scale Limits
107
137
108
138
| Name | Type | Description
109
139
| ---- | -----| -----------
110
-
| `min` | `number` | Minimun allowed value for scale.min
111
-
| `max` | `number` | Maximum allowed value for scale.max
140
+
| `min` | `number | 'original'` | Minimum allowed value for scale.min
141
+
| `max` | `number | 'original'` | Maximum allowed value for scale.max
112
142
| `minRange` | `number` | Minimum allowed range (max - min). This defines the max zoom level.
143
+
144
+
You may use the keyword `'original'` in place of a numeric limit to instruct chartjs-plugin-zoom to use whatever limits the scale had when the chart was first displayed.
0 commit comments