From: Tanner Linsley Date: Mon, 21 Sep 2015 17:52:17 +0000 (-0600) Subject: Time scale now draws all ticks, instead of half of them X-Git-Tag: 2.0.0-alpha4~19^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1473%2Fhead;p=thirdparty%2FChart.js.git Time scale now draws all ticks, instead of half of them Closes #1463 --- 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)