From d8025b19a30b38eae7b08bfbf5b652880a490119 Mon Sep 17 00:00:00 2001 From: Anton Ulyanov Date: Wed, 27 Nov 2024 15:03:49 +0300 Subject: [PATCH] fix time legend Signed-off-by: Anton Ulyanov --- .../src/components/UPlotWrapper/UPlotWrapper.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/statshouse-ui/src/components/UPlotWrapper/UPlotWrapper.tsx b/statshouse-ui/src/components/UPlotWrapper/UPlotWrapper.tsx index 1121a86b0..b10e1dcfc 100644 --- a/statshouse-ui/src/components/UPlotWrapper/UPlotWrapper.tsx +++ b/statshouse-ui/src/components/UPlotWrapper/UPlotWrapper.tsx @@ -83,12 +83,12 @@ function readLegend(u: uPlot): LegendItem[] { if (idx / u.data[index].length < 0.9) { deltaTime = ((u.data?.[0] && u.data[0][idx]) ?? 0) - xMax; } - if (index === 0) { - lastTime = - (typeof s.value === 'function' ? s.value(u, u.data[index][idx], 0, idx) : s.value) - ?.toString() - .replace('--', '') ?? ''; // replace '--' uplot - } + } + if (idx != null && index === 0) { + lastTime = + (typeof s.value === 'function' ? s.value(u, u.data[index][idx], 0, idx) : s.value) + ?.toString() + .replace('--', '') ?? ''; // replace '--' uplot } return { label: s.label ?? '',