Skip to content

Commit 15d42eb

Browse files
committed
only draw interpolated markers in visible data range
1 parent f5e8d21 commit 15d42eb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

site/static/index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,21 +236,23 @@
236236

237237
const interpolatedColorWithAlpha = "#fcb0f15f";
238238

239-
ctx.save();
240239
ctx.strokeStyle = interpolatedColorWithAlpha;
241240
ctx.beginPath();
242241

243-
u.data[0].forEach((v, j) => {
242+
let [ i0, i1 ] = u.series[0].idxs;
243+
244+
for (let j = i0; j <= i1; j++) {
245+
let v = u.data[0][j];
246+
244247
if (isInterpolated(j)) {
245248
let cx = Math.round(u.valToPos(v, 'x', true));
246249
ctx.moveTo(cx, top);
247250
ctx.lineTo(cx, top + height);
248251
}
249-
});
252+
}
250253

251254
ctx.closePath();
252255
ctx.stroke();
253-
ctx.restore();
254256
},
255257
]
256258
},

0 commit comments

Comments
 (0)