From 205f3638cfb623d7f62e742e82b5d7396b618e1d Mon Sep 17 00:00:00 2001 From: Akihiko Kusanagi Date: Thu, 20 Jun 2019 14:38:41 +0800 Subject: [PATCH] Revert some changes for size reduction --- src/scales/scale.time.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index cd15ce1d626..62aebce127d 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -283,11 +283,10 @@ function determineMajorUnit(unit) { /** * Figures out what unit results in an appropriate number of auto-generated ticks */ -function determineUnitsForAutoTicks(scale) { +function determineUnitsForAutoTicks(scale, min, max) { var timeOpts = scale.options.time; var minor = timeOpts.unit; - var max = scale.max; - var range = max - scale.min; + var range = max - min; var ilen = UNITS.length; var i, major, interval, steps, factor, capacity; @@ -342,13 +341,11 @@ function determineUnitForFormatting(scale, ticks, minUnit, min, max) { * Important: this method can return ticks outside the min and max range, it's the * responsibility of the calling code to clamp values if needed. */ -function generate(scale) { - var min = scale.min; - var max = scale.max; +function generate(scale, min, max) { var adapter = scale._adapter; var options = scale.options; var timeOpts = options.time; - var units = determineUnitsForAutoTicks(scale); + var units = determineUnitsForAutoTicks(scale, min, max); var minor = units.minor; var major = units.major; var stepSize = valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize); @@ -646,7 +643,7 @@ module.exports = Scale.extend({ break; case 'auto': default: - timestamps = generate(me); + timestamps = generate(me, min, max); } if (options.bounds === 'ticks' && timestamps.length) {