In version 3.x I can do this with onScaleChange
onScaleChange(listener: (start: number, end: number) => void): Token;
The following code works fine on 3.x and prevents the user from zooming out in oblivion with the mouse wheel.
axisX.onScaleChange((start, end) => {
if (start < minInterval) {
axisX.setInterval(minInterval, end)
}
if (end > maxInterval) {
axisX.setInterval(start, maxInterval)
}
})
If I try it on 4.0 with onIntervalChange
I get stack overflow because setInterval
will trigger a new onIntervalChange
I cannot for the life of me figure out how to avoid it. Noticing the new (axis:this) I tried to remove the listener with offIntervalChange(token) and add it back before exit with no effect. I am stumped.