From: Evert Timberg Date: Mon, 1 Feb 2016 23:44:39 +0000 (-0500) Subject: Fix stacked bar data limit calculation X-Git-Tag: v2.0.0~57^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1963%2Fhead;p=thirdparty%2FChart.js.git Fix stacked bar data limit calculation --- diff --git a/src/scales/scale.linear.js b/src/scales/scale.linear.js index 8c2778509..334e999eb 100644 --- a/src/scales/scale.linear.js +++ b/src/scales/scale.linear.js @@ -85,7 +85,7 @@ }, this); helpers.each(valuesPerType, function(valuesForType) { - var values = hasPositiveValues ? hasNegativeValues ? valuesForType.positiveValues.concat(valuesForType.negativeValues) : valuesForType.positiveValues : valuesForType.negativeValues; + var values = valuesForType.positiveValues.concat(valuesForType.negativeValues); var minVal = helpers.min(values); var maxVal = helpers.max(values) this.min = this.min === null ? minVal : Math.min(this.min, minVal); diff --git a/test/scale.linear.tests.js b/test/scale.linear.tests.js index e21794fc8..a8b9738f9 100644 --- a/test/scale.linear.tests.js +++ b/test/scale.linear.tests.js @@ -207,7 +207,7 @@ describe('Linear Scale', function() { options.stacked = true; scale.determineDataLimits(); - expect(scale.min).toBe(30); + expect(scale.min).toBe(0); expect(scale.max).toBe(90); });