Live chart lets a held window go once its points have scrolled off
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user