After continuous magnification, the coordinate axis becomes the same
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 463
- PR merge metrics
- No merged PRs in 30d
Description
Is there any way to limit the magnification, such as limiting the magnification multiple, or when the selected range is less than a certain value, it is not allowed to enlarge.

I try to set scale and set range for each coordinate axis. As in the example, unfortunately, only the x-axis setting takes effect, but the y-axis does not take effect, and the function does not seem to be called.
My option:
{
cursor: {
drag: { x: true, y: true, uni: 10, dist: 5 },
},
scales: {
x: {
time: false,
min: xRange[0],
max: xRange[1],
range: (self, newMin, newMax) => {
let curMin = self.scales.x.min;
let curMax = self.scales.x.max;
// prevent zoom
if (newMax - newMin < 10) return [curMin, curMax];
// allow zoom
return [newMin, newMax];
},
},
y: {
time: false,
min: yRange[0],
max: yRange[1],
range: (self, newMin, newMax) => {
let curMin = self.scales.y.min;
let curMax = self.scales.y.max;
// prevent zoom
if (newMax - newMin < 5) return [curMin, curMax];
// allow zoom
return [newMin, newMax];
},
},
},
}
My version of uplot is 1.6.13. Thank you very much for your work. This library is very cool.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the scale range callbacks in the supplied configuration and reproduce the continuous magnification using the linked jsfiddle and uPlot 1.6.13. Compare the x- and y-axis behavior, then verify that both configured minimum ranges prevent further enlargement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100