From c20e57bc8ae86f2881b1f894b1767d95194bada1 Mon Sep 17 00:00:00 2001 From: Thomas Redston Date: Fri, 13 Jan 2017 17:55:28 +0000 Subject: [PATCH] Only generate ticks we care about Instead of cloning `me.scaleSizeInUnits` moments and probably throwing the vast majority away, only clone what we need. --- src/scales/scale.time.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index 61796c6eb..9a3e31e63 100755 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -324,7 +324,7 @@ module.exports = function(Chart) { me.ticks.push(me.firstTick.clone()); // For every unit in between the first and last moment, create a moment and add it to the ticks tick - for (var i = 1; i <= me.scaleSizeInUnits; ++i) { + for (var i = me.unitScale; i <= me.scaleSizeInUnits; i += me.unitScale) { var newTick = roundedStart.clone().add(i, me.tickUnit); // Are we greater than the max time @@ -332,9 +332,7 @@ module.exports = function(Chart) { break; } - if (i % me.unitScale === 0) { - me.ticks.push(newTick); - } + me.ticks.push(newTick); } // Always show the right tick -- 2.47.3