Skip to content

Commit

Permalink
1) In response to issue 4263, try a little harder to produce nice scales
Browse files Browse the repository at this point in the history
when there is scope to do so.

2) When chart is type 'bar', ensure reference to zero is maintained
when zoomed and auto scaling the Y axis.
  • Loading branch information
rosco54 committed Mar 7, 2024
1 parent b9d5110 commit fe6901c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modules/Scales.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ export default class Scales {
} else {
let yMaxPrev = yMax
yMax = stepSize * Math.ceil(yMax / stepSize)
if (Math.abs(yMax - yMin) / Utils.getGCD(range, stepSize) > maxTicks) {
// Use default ticks to compute yMax then shrinkwrap
yMax = yMin + stepSize * ticks
yMax -= stepSize * Math.floor((yMax - yMaxPrev) / stepSize)
}
}
}
range = Math.abs(yMax - yMin)
Expand Down

0 comments on commit fe6901c

Please sign in to comment.