Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly initialize min/max of boundary search #256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/objects/axis/begin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/objects/chart/methods/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
8 changes: 6 additions & 2 deletions src/objects/series/methods/_axisBounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down