From: Evert Timberg Date: Mon, 18 Jan 2016 01:37:43 +0000 (-0500) Subject: Fix reversed ticks on linear scale + update test X-Git-Tag: v2.0.0~66^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1908%2Fhead;p=thirdparty%2FChart.js.git Fix reversed ticks on linear scale + update test --- diff --git a/src/scales/scale.linear.js b/src/scales/scale.linear.js index 3adfd8bd5..3e0de4c1e 100644 --- a/src/scales/scale.linear.js +++ b/src/scales/scale.linear.js @@ -197,7 +197,6 @@ // 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(); @@ -209,6 +208,7 @@ this.end = this.max; } + this.ticksAsNumbers = this.ticks.slice(); // do after we potentially reverse the ticks this.zeroLineIndex = this.ticks.indexOf(0); }, diff --git a/test/scale.linear.tests.js b/test/scale.linear.tests.js index 7be311cd3..2d2cdb3dd 100644 --- a/test/scale.linear.tests.js +++ b/test/scale.linear.tests.js @@ -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); });