Skip to main content

Crate rdom_charts

Crate rdom_charts 

Source
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 it

Components: 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.
BarChartView
A shareable handle that owns a BarChart and renders it onto a <canvas> element.
DataPoint
A single data point. value == NaN marks a gap (line breaks there).
Gauge
A linear gauge.
GaugeView
A shareable handle that owns a Gauge and renders it onto a <canvas> element.
GaugeZone
A colored band covering values up to upto (inclusive). Zones are matched in ascending upto order; the first whose upto >= value wins.
Guideline
Horizontal reference line drawn across the plot.
Series
Series definition supplied by callers.
Sparkline
A compact single-series line chart.
SparklineView
A shareable handle that owns a Sparkline and renders it onto a <canvas> element. See TimeSeriesView for the same mount/update pattern.
TimeRange
A time range (visible window, loaded range, etc.).
TimeSeriesChart
A time-series chart: data buffers + a visible window + render config.
TimeSeriesView
A shareable handle that owns a TimeSeriesChart and renders it onto a <canvas> element.
XAxisConfig
X-axis configuration.
YAxisConfig
Y-axis configuration.

Enums§

ConnectPolicy
How to handle missing data points (NaN or absent).
SeriesStyle
Rendering style per series.