From 1de0435feb2890c5e40114e297c1ea21899de71f Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Sun, 17 Jan 2016 20:37:43 -0500 Subject: [PATCH] Fix reversed ticks on linear scale + update test --- src/scales/scale.linear.js | 2 +- test/scale.linear.tests.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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); }); -- 2.47.2