From: Thomas Redston Date: Fri, 13 Jan 2017 17:55:28 +0000 (+0000) Subject: Only generate ticks we care about X-Git-Tag: v2.5.0~1^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c20e57bc8ae86f2881b1f894b1767d95194bada1;p=thirdparty%2FChart.js.git Only generate ticks we care about Instead of cloning `me.scaleSizeInUnits` moments and probably throwing the vast majority away, only clone what we need. --- 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