diff --git a/frontend/src/components/Common/UplotChart.tsx b/frontend/src/components/Common/UplotChart.tsx index ea9aeb2..d4a9c97 100644 --- a/frontend/src/components/Common/UplotChart.tsx +++ b/frontend/src/components/Common/UplotChart.tsx @@ -466,9 +466,17 @@ export function UplotChart({ // is held the data goes in and the scales stay where they were put. Clearing // the window renders, which brings the next pass through here with the reset // back on: that is what puts the whole range back. + // + // A live chart keeps a count of points rather than a span, so a held window + // scrolls off the left as readings arrive. Once its last point has gone it + // is let go, or the chart would sit empty until somebody reset it. useEffect(() => { - if (!chart.current || plots.length === 0) return - chart.current.setData(table(plots), !zoomed.current) + const plot = chart.current + if (!plot || plots.length === 0) return + const data = table(plots) + const held = plot.scales.x.max + if (zoomed.current && held != null && held < data[0][0]) clearZoom() + plot.setData(data, !zoomed.current) }) // The canvas cannot follow a CSS variable, so a theme swap is a redraw. The