Commit 07bf4c0b by benrubson

Missing values, keep interpolation

parent 04a276dc
...@@ -92,7 +92,7 @@ charts or filled areas). ...@@ -92,7 +92,7 @@ charts or filled areas).
// ignore point // ignore point
i += ps; i += ps;
} }
else if (j < otherpoints.length && qx == null && qy == null) { else if (j < otherpoints.length && qx == null) {
// ignore point // ignore point
j += otherps; j += otherps;
} }
...@@ -111,7 +111,7 @@ charts or filled areas). ...@@ -111,7 +111,7 @@ charts or filled areas).
} }
else { else {
// cases where we actually got two points // cases where we actually got two points
if (px == qx || qx == null) { if (px == qx) {
// take the point from the current series and skip the previous' one // take the point from the current series and skip the previous' one
for (m = 0; m < ps; ++m) for (m = 0; m < ps; ++m)
newpoints.push(points[i + m]); newpoints.push(points[i + m]);
...@@ -127,7 +127,10 @@ charts or filled areas). ...@@ -127,7 +127,10 @@ charts or filled areas).
for (m = 0; m < ps; ++m) for (m = 0; m < ps; ++m)
newpoints.push(otherpoints[j + m]); newpoints.push(otherpoints[j + m]);
newpoints[l]=null; // we might be able to interpolate
if (i > 0 && points[i - ps] != null)
newpoints[l + accumulateOffset] += py + (points[i - ps + accumulateOffset] - py) * (qx - px) / (points[i - ps + keyOffset] - px);
bottom = qy; bottom = qy;
j += otherps; j += otherps;
...@@ -137,6 +140,13 @@ charts or filled areas). ...@@ -137,6 +140,13 @@ charts or filled areas).
for (m = 0; m < ps; ++m) for (m = 0; m < ps; ++m)
newpoints.push(points[i + m]); newpoints.push(points[i + m]);
// we might be able to interpolate a point below,
// this can give us a better y
if (j > 0 && otherpoints[j - otherps] != null)
bottom = qy + (otherpoints[j - otherps + accumulateOffset] - qy) * (px - qx) / (otherpoints[j - otherps + keyOffset] - qx);
newpoints[l + accumulateOffset] += bottom;
i += ps; i += ps;
} }
} }
......
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