Streaming chart
v0.64.0, changelogBetaA live canvas line chart for robot telemetry at 20 to 50 Hz, fed by push() without a React render per reading, with a scrolling window, pause, limit lines, crosshair, legend and table view.
- Left wheel
- Right wheel
- Lift
Space pauses or resumes. Left and right arrows move back and forward in time. End returns to live.
Default
Install
npx shadcn add @syncrobotic/streaming-chart Also installs: lucide-react@^1, @syncrobotic/cn, @syncrobotic/status-glyph, @syncrobotic/button, @syncrobotic/dropdown-menu, @syncrobotic/segmented-control, @syncrobotic/table, @syncrobotic/clock-time, @syncrobotic/use-reduced-motion, @syncrobotic/theme-change, @syncrobotic/format-number
Overview
When to use
- Motor currents, speed, a temperature or a battery's voltage on a robot's page while it works or is commissioned.
- Watching a value against its limit as it happens: a motor heating up, a pack sagging under load.
- Any ROS topic of numbers (std_msgs/Float64, a field of sensor_msgs/BatteryState or JointState), pushed as it arrives.
Use something else
- A history read afterwards (a shift, a week, a mission): Chart, with its table.
- One value now: a Metric card, or a Meter for a level within a range.
- A value that needs someone to act when it crosses a limit: raise an Alarm; the chart shows the trend, the alarm asks for the action.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Paused
Small multiples
Stale
Waiting
From ROS
Usage rules
- For values arriving many times a second that someone watches as they happen: motor currents, speed, a temperature, a battery's voltage. A history read afterwards (a shift, a week) is
chart; one value now is ametric-cardor ameter. - Push readings, never pass them as props:
ref.current.push({, or aleft: 12.4 }) subscribefunction that getspushonce and returns its cleanup. The chart keeps them in its own ring buffers and draws on the next frame; a reading never renders React. - Stamp each reading with the message's time (
header.stampthroughstampToMs) when it has one: the time axis follows the readings' own clock, so a robot whose clock is off by seconds still draws at the right edge. - One unit per chart, as every chart has one y axis: three motor currents together, but speed, temperature and voltage as three charts (small multiples), driven by one set of controls through
windowandpausedwithcontrols={false}on the others. - The palette and line styles are
chart's: the series to watch is slot 1, solid; the next two graphite, dashed then dotted; three series and Other at most. Never a status colour for a series. - Fix
domainfor a value with known bounds (a current's range, a pack's voltage), so the lines do not jump as the range follows the data. Without it the range rounds to steps around what is in view and the limits. - A limit is a dashed line with its label at the end; only the legend says a series is past it, in words beside a warning triangle, and screen readers hear it once as it crosses.
over:for a floor (a battery voltage)."below" - Keep
staleAfterMsnear three missed readings at the stream's rate (the default 2 s suits 2 Hz and faster);nullonly for a chart of data that is not live. Silence breaks the line and says No new data with the last reading's time, instead of drawing a flat line across it. - Pause freezes the view only: readings keep arriving into the buffer, which holds
capacityreadings per series (10 minutes at 60 Hz by default). Raise it for a longer window at a high rate. - Under reduced motion the view steps once a second instead of gliding. Off screen and in a hidden tab nothing is drawn.
Changelog
- 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
- 0.53.02026-11-27Its doc opens with its description, word for word; the code is unchanged.
- 0.51.02026-11-27Comments trimmed to what they need to say; the code is unchanged.