Fix line extension on the right side

This commit is contained in:
2024-05-08 20:30:02 +01:00
parent e88cc98812
commit 0ab4e5a9a1

View File

@@ -112,7 +112,7 @@ export const CanvasChart = ({ total, hueOffset = 0, domain, hardDomain, dataKey,
ctx.lineTo(x, y); ctx.lineTo(x, y);
} }
ctx.lineTo(width + xMargin, height - (height * (history.current.data[0][dataKey][i] ?? 0)) / max.current); ctx.lineTo(width + xMargin, height - (height * (history.current.data.at(-1)?.[dataKey][i] ?? 0)) / max.current);
ctx.lineTo(width + xMargin, height); ctx.lineTo(width + xMargin, height);
if (type === 'fill') ctx.fill(); if (type === 'fill') ctx.fill();