]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix reversed ticks on linear scale + update test 1908/head
authorEvert Timberg <evert.timberg@gmail.com>
Mon, 18 Jan 2016 01:37:43 +0000 (20:37 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Mon, 18 Jan 2016 01:37:43 +0000 (20:37 -0500)
src/scales/scale.linear.js
test/scale.linear.tests.js

index 3adfd8bd585dc007b43c7f79284a507c47f3f6df..3e0de4c1ea1b248027153efb1572ef5660164867 100644 (file)
                        // range of the scale
                        this.max = helpers.max(this.ticks);
                        this.min = helpers.min(this.ticks);
-                       this.ticksAsNumbers = this.ticks.slice();
 
                        if (this.options.ticks.reverse) {
                                this.ticks.reverse();
                                this.end = this.max;
                        }
 
+                       this.ticksAsNumbers = this.ticks.slice(); // do after we potentially reverse the ticks
                        this.zeroLineIndex = this.ticks.indexOf(0);
                },
 
index 7be311cd3e6d3b512604313749a327729ecdd752..2d2cdb3dd4516babee79954dde8ef1c813e2f36a 100644 (file)
@@ -572,6 +572,7 @@ describe('Linear Scale', function() {
 
                // Reverse mode makes this count up
                expect(scale.ticks).toEqual([0, 10, 20, 30, 40, 50, 60, 70, 80]);
+               expect(scale.ticksAsNumbers).toEqual([0, 10, 20, 30, 40, 50, 60, 70, 80]);
                expect(scale.start).toBe(80);
                expect(scale.end).toBe(0);
        });