]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Time scale now draws all ticks, instead of half of them 1473/head
authorTanner Linsley <tannerlinsley@gmail.com>
Mon, 21 Sep 2015 17:52:17 +0000 (11:52 -0600)
committerTanner Linsley <tannerlinsley@gmail.com>
Mon, 21 Sep 2015 17:52:17 +0000 (11:52 -0600)
Closes #1463

samples/combo-time-scale.html
src/scales/scale.time.js

index 61acfa6c1043158222d51ec023cedf8249aaece3..548202e2cad25457eb7bb077bcb53c8c99e3a0c4 100644 (file)
         $('#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')
                 );
 
index 140ff72299e8b046bf5407974ba486d6bee09c81..d761e7d3d394c9efe85cbc11e1a35bcaa8b67b2d 100644 (file)
 
                        // 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)
                                        );
                                }
                        } 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)