Handling empty history (#28852)

Co-authored-by: DAccord <11232265+DAccord@users.noreply.github.com>
This commit is contained in:
DAccord 2026-01-08 10:58:38 +01:00 committed by Bram Kragten
parent 3c5a6193d0
commit 303538ac21

View File

@ -7,6 +7,11 @@ const calcPoints = (
height: number,
limits?: { minX?: number; maxX?: number; minY?: number; maxY?: number }
) => {
// handling empty history (for example unavailable for long time)
if (history.length === 0) {
return { points: [], yAxisOrigin: height };
}
let yAxisOrigin = height;
let minY = limits?.minY ?? history[0][1];
let maxY = limits?.maxY ?? history[0][1];