Skip to content

Commit

Permalink
fix(stepped): only null become a gap -> undefined is use for no data …
Browse files Browse the repository at this point in the history
…by this serie
  • Loading branch information
Leubeling committed May 13, 2022
1 parent 88f3d7a commit 7c89128
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/paths/stepped.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ export function stepped(opts) {

let x1 = pxRound(valToPosX(dataX[i], scaleX, xDim, xOff));

if (yVal1 == null && i < idx1) {
if (yVal1 === null) {
addGap(gaps, prevXPos, x1);
if (yVal1 === null && i < idx1) {
if(align === 1) {
prevXPos = inGap ? prevXPos : x1;
inGap = true;
} else {
addGap(gaps, prevXPos, x1);
}
continue;
}

let y1 = pxRound(valToPosY(yVal1, scaleY, yDim, yOff));
let y1 = yVal1 === undefined ? prevYPos : pxRound(valToPosY(yVal1, scaleY, yDim, yOff));

if (inGap) {
addGap(gaps, prevXPos, x1);
Expand All @@ -52,9 +54,14 @@ export function stepped(opts) {

if (align == 1)
lineTo(stroke, x1, prevYPos);
else
lineTo(stroke, prevXPos, y1);

else {
if(yVal1 !== undefined){
lineTo(stroke, prevXPos, y1);
}else{
x1 = prevXPos
y1 = prevYPos
}
}
lineTo(stroke, x1, y1);

prevYPos = y1;
Expand Down

0 comments on commit 7c89128

Please sign in to comment.