|
@@ -78,9 +78,12 @@ charts or filled areas).
|
|
|
i = 0, j = 0, l, m;
|
|
i = 0, j = 0, l, m;
|
|
|
|
|
|
|
|
while (true) {
|
|
while (true) {
|
|
|
|
|
+ // browse all points from the current series and from the previous series
|
|
|
if (i >= points.length && j >= otherpoints.length)
|
|
if (i >= points.length && j >= otherpoints.length)
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
+ // newpoints will replace current series with
|
|
|
|
|
+ // as many points as different timestamps we have in the 2 (current & previous) series
|
|
|
l = newpoints.length;
|
|
l = newpoints.length;
|
|
|
px = points[i + keyOffset];
|
|
px = points[i + keyOffset];
|
|
|
py = points[i + accumulateOffset];
|
|
py = points[i + accumulateOffset];
|
|
@@ -89,30 +92,32 @@ charts or filled areas).
|
|
|
bottom = 0;
|
|
bottom = 0;
|
|
|
|
|
|
|
|
if (i < points.length && px == null) {
|
|
if (i < points.length && px == null) {
|
|
|
- // ignore point
|
|
|
|
|
|
|
+ // let's ignore null points from current series, nothing to do with them
|
|
|
i += ps;
|
|
i += ps;
|
|
|
}
|
|
}
|
|
|
else if (j < otherpoints.length && qx == null) {
|
|
else if (j < otherpoints.length && qx == null) {
|
|
|
- // ignore point
|
|
|
|
|
|
|
+ // let's ignore null points from previous series, nothing to do with them
|
|
|
j += otherps;
|
|
j += otherps;
|
|
|
}
|
|
}
|
|
|
else if (i >= points.length) {
|
|
else if (i >= points.length) {
|
|
|
- // take the remaining points from the previous series
|
|
|
|
|
|
|
+ // no more points in the current series, simply take the remaining points
|
|
|
|
|
+ // from the previous series so that next series will correctly stack
|
|
|
for (m = 0; m < ps; ++m)
|
|
for (m = 0; m < ps; ++m)
|
|
|
newpoints.push(otherpoints[j + m]);
|
|
newpoints.push(otherpoints[j + m]);
|
|
|
bottom = qy;
|
|
bottom = qy;
|
|
|
j += otherps;
|
|
j += otherps;
|
|
|
}
|
|
}
|
|
|
else if (j >= otherpoints.length) {
|
|
else if (j >= otherpoints.length) {
|
|
|
- // take the remaining points from the current series
|
|
|
|
|
|
|
+ // no more points in the previous series, of course let's take
|
|
|
|
|
+ // the remaining points from the current series
|
|
|
for (m = 0; m < ps; ++m)
|
|
for (m = 0; m < ps; ++m)
|
|
|
newpoints.push(points[i + m]);
|
|
newpoints.push(points[i + m]);
|
|
|
i += ps;
|
|
i += ps;
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- // cases where we actually got two points
|
|
|
|
|
|
|
+ // next available points from current and previous series have the same timestamp
|
|
|
if (px == qx) {
|
|
if (px == qx) {
|
|
|
- // take the point from the current series and skip the previous' one
|
|
|
|
|
|
|
+ // so 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]);
|
|
|
|
|
|
|
@@ -122,8 +127,9 @@ charts or filled areas).
|
|
|
i += ps;
|
|
i += ps;
|
|
|
j += otherps;
|
|
j += otherps;
|
|
|
}
|
|
}
|
|
|
|
|
+ // next available point with the smallest timestamp is from the previous series
|
|
|
else if (px > qx) {
|
|
else if (px > qx) {
|
|
|
- // take the point from the previous series so that the next series can stack over it
|
|
|
|
|
|
|
+ // so take the point from the previous series so that next series will correctly stack
|
|
|
for (m = 0; m < ps; ++m)
|
|
for (m = 0; m < ps; ++m)
|
|
|
newpoints.push(otherpoints[j + m]);
|
|
newpoints.push(otherpoints[j + m]);
|
|
|
|
|
|
|
@@ -135,8 +141,9 @@ charts or filled areas).
|
|
|
|
|
|
|
|
j += otherps;
|
|
j += otherps;
|
|
|
}
|
|
}
|
|
|
- else { // px < qx
|
|
|
|
|
- // take the point from the current series
|
|
|
|
|
|
|
+ // (px < qx) next available point with the smallest timestamp is from the current series
|
|
|
|
|
+ else {
|
|
|
|
|
+ // so of course let's take the point from the current series
|
|
|
for (m = 0; m < ps; ++m)
|
|
for (m = 0; m < ps; ++m)
|
|
|
newpoints.push(points[i + m]);
|
|
newpoints.push(points[i + m]);
|
|
|
|
|
|