From 0ab4e5a9a13be4575746062814f58b9b7e4a51f8 Mon Sep 17 00:00:00 2001 From: luisdralves Date: Wed, 8 May 2024 20:30:02 +0100 Subject: [PATCH] Fix line extension on the right side --- src/client/components/chart-cards/common/chart/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/components/chart-cards/common/chart/index.tsx b/src/client/components/chart-cards/common/chart/index.tsx index 5a870cf..26468e8 100644 --- a/src/client/components/chart-cards/common/chart/index.tsx +++ b/src/client/components/chart-cards/common/chart/index.tsx @@ -112,7 +112,7 @@ export const CanvasChart = ({ total, hueOffset = 0, domain, hardDomain, dataKey, 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); if (type === 'fill') ctx.fill();