diff --git a/src/objects/axis/begin.js b/src/objects/axis/begin.js index 6f24504b..4e2e6685 100755 --- a/src/objects/axis/begin.js +++ b/src/objects/axis/begin.js @@ -64,8 +64,8 @@ // The scale determined by the update method this._scale = null; // The minimum and maximum axis values - this._min = 0; - this._max = 0; + this._min = Infinity; + this._max = -Infinity; // Chart origin before and after an update. This helps // with transitions this._previousOrigin = null; diff --git a/src/objects/chart/methods/draw.js b/src/objects/chart/methods/draw.js index b3705293..fe195ed3 100644 --- a/src/objects/chart/methods/draw.js +++ b/src/objects/chart/methods/draw.js @@ -31,8 +31,8 @@ // Iterate the axes and calculate bounds, this is done within the chart because an // axis' bounds are determined by other axes and the way that series tie them together this.axes.forEach(function (axis) { - axis._min = 0; - axis._max = 0; + axis._min = Infinity; + axis._max = -Infinity; linkedDimensions = []; // Check that the axis has a measure if (axis._hasMeasure()) { diff --git a/src/objects/series/methods/_axisBounds.js b/src/objects/series/methods/_axisBounds.js index 4b464662..870df25f 100644 --- a/src/objects/series/methods/_axisBounds.js +++ b/src/objects/series/methods/_axisBounds.js @@ -2,7 +2,7 @@ // License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt" // Source: /src/objects/series/methods/_axisBounds.js this._axisBounds = function (position) { - var bounds = { min: 0, max: 0 }, + var bounds = { min: Infinity, max: -Infinity }, // The primary axis for this comparison primaryAxis = null, // The secondary axis for this comparison @@ -78,7 +78,11 @@ } // Get the index of the field if (categoryTotals[index] === undefined) { - categoryTotals[index] = { min: 0, max: 0 }; + if (this.stacked) { + categoryTotals[index] = { min: 0, max: 0 }; + } else { + categoryTotals[index] = { min: Infinity, max: -Infinity }; + } if (index >= catCount) { catCount = index + 1; }