@@ -282,6 +282,11 @@ export default class Scales {
282
282
} else {
283
283
let yMaxPrev = yMax
284
284
yMax = stepSize * Math . ceil ( yMax / stepSize )
285
+ if ( Math . abs ( yMax - yMin ) / Utils . getGCD ( range , stepSize ) > maxTicks ) {
286
+ // Use default ticks to compute yMin then shrinkwrap
287
+ yMax = yMin + stepSize * ticks
288
+ yMax += stepSize * Math . ceil ( ( yMaxPrev - yMax ) / stepSize )
289
+ }
285
290
}
286
291
}
287
292
range = Math . abs ( yMax - yMin )
@@ -314,16 +319,6 @@ export default class Scales {
314
319
stepSize = Math . round ( range / tiks )
315
320
}
316
321
317
- // Record final tiks for use by other series that call niceScale().
318
- // Note: some don't, like logarithmicScale(), etc.
319
- if (
320
- gl . isMultipleYAxis
321
- && gl . multiAxisTickAmount == 0
322
- && gl . ignoreYAxisIndexes . indexOf ( index ) < 0
323
- ) {
324
- gl . multiAxisTickAmount = tiks
325
- }
326
-
327
322
if (
328
323
tiks > maxTicks &&
329
324
( ! ( gotTickAmount || gotStepSize ) || axisCnf . forceNiceScale )
@@ -386,6 +381,17 @@ export default class Scales {
386
381
} else {
387
382
stepSize = range / tt
388
383
}
384
+ tiks = Math . round ( range / stepSize )
385
+ }
386
+
387
+ // Record final tiks for use by other series that call niceScale().
388
+ // Note: some don't, like logarithmicScale(), etc.
389
+ if (
390
+ gl . isMultipleYAxis
391
+ && gl . multiAxisTickAmount == 0
392
+ && gl . ignoreYAxisIndexes . indexOf ( index ) < 0
393
+ ) {
394
+ gl . multiAxisTickAmount = tiks
389
395
}
390
396
391
397
// build Y label array.
0 commit comments