From 2a76ff00372266612206310178e47611b7b4d2fb Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Mon, 21 Sep 2015 11:52:17 -0600 Subject: [PATCH] Time scale now draws all ticks, instead of half of them Closes #1463 --- samples/combo-time-scale.html | 4 +--- src/scales/scale.time.js | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/samples/combo-time-scale.html b/samples/combo-time-scale.html index 61acfa6c1..548202e2c 100644 --- a/samples/combo-time-scale.html +++ b/samples/combo-time-scale.html @@ -152,9 +152,7 @@ $('#addData').click(function() { if (config.data.datasets.length > 0) { config.data.labels.push( - moment( - config.data.labels[config.data.labels.length - 1], config.options.scales.xAxes[0].time.format - ).add(1, 'day') + myLine.scales['x-axis-0'].labelMoments[myLine.scales['x-axis-0'].labelMoments.length - 1].add(1, 'day') .format('MM/DD/YYYY') ); diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index 140ff7229..d761e7d3d 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -176,7 +176,7 @@ // For every unit in between the first and last moment, create a moment and add it to the labels tick if (this.options.labels.userCallback) { - for (; i <= this.tickRange; i++) { + for (i = 0; i <= this.tickRange; i++) { this.ticks.push( this.options.labels.userCallback(this.firstTick.clone() .add(i, this.tickUnit) @@ -185,7 +185,7 @@ ); } } else { - for (; i <= this.tickRange; i++) { + for (i = 0; i <= this.tickRange; i++) { this.ticks.push(this.firstTick.clone() .add(i, this.tickUnit) .format(this.options.tick.displayFormat ? this.options.tick.displayFormat : time.unit[this.tickUnit].display) -- 2.47.2