Skip to content

Commit

Permalink
In niceScale() when passed yMin and yMax indicate no data, cannot
Browse files Browse the repository at this point in the history
simply use w.globals.min and w.globals.max because the user may have
configured one or both as a function, which can cause those global
values to be poor substitutes causing undefined behaviour. Substitute
sane default values in that case.
  • Loading branch information
rosco54 committed Apr 16, 2024
1 parent 9158723 commit abb5542
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/modules/Scales.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,8 @@ export default class Scales {
(yMin === Number.MIN_VALUE && yMax === -Number.MAX_VALUE)
) {
// when all values are 0
if (gotMin && gotMax) {
yMin = gl.minY
yMax = gl.maxY
} else if (gotMin) {
yMin = gl.minY
yMax = yMin + ticks
} else if (gotMax) {
yMax = gl.maxY
yMin = yMax - ticks
} else {
yMin = 0
yMax = ticks
}
yMin = Utils.isNumber(axisCnf.min) ? axisCnf.min : 0
yMax = Utils.isNumber(axisCnf.max) ? axisCnf.max : yMin + ticks
gl.allSeriesCollapsed = false
}

Expand Down

0 comments on commit abb5542

Please sign in to comment.