From 1f677569eb38a888bbfa126d922fbbf8e0964f08 Mon Sep 17 00:00:00 2001 From: Gion Kunz Date: Sun, 23 Oct 2016 21:29:46 +0200 Subject: [PATCH] Fixed rounding issues where raw value was added instead of rounded, fixes #815 --- src/scripts/core.js | 2 +- test/spec/spec-core.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/core.js b/src/scripts/core.js index b568852..4f4428b 100644 --- a/src/scripts/core.js +++ b/src/scripts/core.js @@ -800,7 +800,7 @@ var Chartist = { for (i = bounds.min; i <= bounds.max; i = safeIncrement(i, bounds.step)) { var value = Chartist.roundWithPrecision(i); if (value !== values[values.length - 1]) { - values.push(i); + values.push(value); } } bounds.values = values; diff --git a/test/spec/spec-core.js b/test/spec/spec-core.js index 6195410..4049883 100644 --- a/test/spec/spec-core.js +++ b/test/spec/spec-core.js @@ -421,7 +421,7 @@ describe('Chartist core', function() { expect(bounds.max).toBe(1000); expect(bounds.low).toBe(999.9999999999997); expect(bounds.high).toBe(1000.0000000000001); - expect(bounds.values).toEqual([999.9999999999999]); + expect(bounds.values).toEqual([Chartist.roundWithPrecision(999.9999999999999)]); }); });