Commit 0dd400db authored by olau@iola.dk's avatar olau@iola.dk

Fixed a bug with stacking bars when there's missing something in the

bottom-most series


git-svn-id: https://flot.googlecode.com/svn/trunk@176 1e0a6537-2640-0410-bfb7-f154510ff394
parent 8d94678e
...@@ -57,7 +57,7 @@ also adjusted. ...@@ -57,7 +57,7 @@ also adjusted.
otherps = other.datapoints.pointsize, otherps = other.datapoints.pointsize,
otherpoints = other.datapoints.points, otherpoints = other.datapoints.points,
newpoints = [], newpoints = [],
px, py, intery, qx, qy, px, py, intery, qx, qy, bottom,
withlines = s.lines.show, withbars = s.bars.show, withlines = s.lines.show, withbars = s.bars.show,
withsteps = withlines && s.lines.steps, withsteps = withlines && s.lines.steps,
i = 0, j = 0, l; i = 0, j = 0, l;
...@@ -82,12 +82,14 @@ also adjusted. ...@@ -82,12 +82,14 @@ also adjusted.
py = points[i + 1]; py = points[i + 1];
qx = otherpoints[j]; qx = otherpoints[j];
qy = otherpoints[j + 1]; qy = otherpoints[j + 1];
bottom = 0;
if (px == qx) { if (px == qx) {
for (m = 0; m < ps; ++m) for (m = 0; m < ps; ++m)
newpoints.push(points[i + m]); newpoints.push(points[i + m]);
newpoints[l + 1] += qy; newpoints[l + 1] += qy;
bottom = qy;
i += ps; i += ps;
j += otherps; j += otherps;
...@@ -101,6 +103,7 @@ also adjusted. ...@@ -101,6 +103,7 @@ also adjusted.
newpoints.push(intery + qy) newpoints.push(intery + qy)
for (m = 2; m < ps; ++m) for (m = 2; m < ps; ++m)
newpoints.push(points[i + m]); newpoints.push(points[i + m]);
bottom = qy;
} }
j += otherps; j += otherps;
...@@ -111,17 +114,16 @@ also adjusted. ...@@ -111,17 +114,16 @@ also adjusted.
// we might be able to interpolate a point below, // we might be able to interpolate a point below,
// this can give us a better y // this can give us a better y
if (withlines && j > 0 && otherpoints[j - ps] != null) { if (withlines && j > 0 && otherpoints[j - ps] != null)
intery = qy + (otherpoints[j - ps + 1] - qy) * (px - qx) / (otherpoints[j - ps] - qx); bottom = qy + (otherpoints[j - ps + 1] - qy) * (px - qx) / (otherpoints[j - ps] - qx);
newpoints[l + 1] += intery; newpoints[l + 1] += bottom;
}
i += ps; i += ps;
} }
if (l != newpoints.length && withbars) if (l != newpoints.length && withbars)
newpoints[l + 2] += qy; newpoints[l + 2] += bottom;
} }
// maintain the line steps invariant // maintain the line steps invariant
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment