Expand description
§rdom-charts
Terminal charts for rdom, the browser-faithful DOM for terminal applications: a time-series line chart, a sparkline, a bar chart, and a rich gauge.
Each chart paints onto a <canvas> element through rdom-tui’s public
API — sub-cell rasterized (a 2×4 braille dot grid for lines, eighth
block glyphs for bars) — and never reaches into rdom internals, so
the crate evolves independently of the substrate. A *View handle
mounts a chart on a canvas and lets the app update it between frames:
use rdom_charts::{Series, DataPoint, TimeSeriesChart, TimeSeriesView};
use rdom_tui::TuiDom;
let chart = TimeSeriesChart::new_static(vec![Series::line(
"cpu",
(0..120).map(|i| DataPoint::new(i as f64, (i as f64 * 0.1).sin() * 40.0 + 50.0)).collect(),
)]);
let view = TimeSeriesView::new(chart);
let mut dom = TuiDom::new();
let canvas = view.mount(&mut dom); // a <canvas> NodeId — append + size itComponents: TimeSeriesChart / TimeSeriesView (with Guideline
threshold lines, EMA smoothing, follow/zoom/pan), Sparkline,
BarChart, Gauge (+ GaugeZone). See the examples/ for
runnable demos.
Modules§
- palette
- Color palette for data-visualization components.
Structs§
- Bar
- One labeled bar.
- BarChart
- A horizontal bar chart.
- BarChart
View - A shareable handle that owns a
BarChartand renders it onto a<canvas>element. - Data
Point - A single data point.
value == NaNmarks a gap (line breaks there). - Gauge
- A linear gauge.
- Gauge
View - A shareable handle that owns a
Gaugeand renders it onto a<canvas>element. - Gauge
Zone - A colored band covering values up to
upto(inclusive). Zones are matched in ascendinguptoorder; the first whoseupto >= valuewins. - Guideline
- Horizontal reference line drawn across the plot.
- Series
- Series definition supplied by callers.
- Sparkline
- A compact single-series line chart.
- Sparkline
View - A shareable handle that owns a
Sparklineand renders it onto a<canvas>element. SeeTimeSeriesViewfor the same mount/update pattern. - Time
Range - A time range (visible window, loaded range, etc.).
- Time
Series Chart - A time-series chart: data buffers + a visible window + render config.
- Time
Series View - A shareable handle that owns a
TimeSeriesChartand renders it onto a<canvas>element. - XAxis
Config - X-axis configuration.
- YAxis
Config - Y-axis configuration.
Enums§
- Connect
Policy - How to handle missing data points (NaN or absent).
- Series
Style - Rendering style per series.