Skip to content

Commit cef328b

Browse files
committed
fix time legend
Signed-off-by: Anton Ulyanov <[email protected]>
1 parent 77080f9 commit cef328b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

statshouse-ui/src/components/UPlotWrapper/UPlotWrapper.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ function readLegend(u: uPlot): LegendItem[] {
8383
if (idx / u.data[index].length < 0.9) {
8484
deltaTime = ((u.data?.[0] && u.data[0][idx]) ?? 0) - xMax;
8585
}
86-
if (index === 0) {
87-
lastTime =
88-
(typeof s.value === 'function' ? s.value(u, u.data[index][idx], 0, idx) : s.value)
89-
?.toString()
90-
.replace('--', '') ?? ''; // replace '--' uplot
91-
}
86+
}
87+
if (idx != null && index === 0) {
88+
lastTime =
89+
(typeof s.value === 'function' ? s.value(u, u.data[index][idx], 0, idx) : s.value)
90+
?.toString()
91+
.replace('--', '') ?? ''; // replace '--' uplot
9292
}
9393
return {
9494
label: s.label ?? '',

0 commit comments

Comments
 (0)