Skip to main content

Crate plotting

Crate plotting 

Source
Expand description

Chart intermediate representation plus renderers for the three report kinds (Balance, Activity, Category Breakdown).

Consumers select a renderer through features:

  • svg pulls plotters::SVGBackend and exposes svg::render_svg. Implies adapters.
  • canvas pulls plotters-canvas and exposes canvas::render_canvas for wasm32 targets. Does not imply adapters — canvas consumers receive a pre-built ChartSpec over JSON.
  • ratatui exposes ratatui::render_ratatui for the TUI. Implies adapters.
  • kitty rasterises the same spec to PNG and emits a kitty graphics APC escape sequence via kitty::render_kitty. Implies adapters.

Everything shares the spec::ChartSpec intermediate representation. When adapters is enabled, adapters builds specs from server view projections; otherwise consumers construct specs directly (the WASM client does this by deserialising JSON from the server).

Re-exports§

pub use spec::ChartKind;
pub use spec::ChartSpec;
pub use spec::Series;
pub use spec::SeriesPoint;

Modules§

adapters
Turn view projections into chart specs. Adapters are pure functions that handle top-N clipping, multi-currency scaling decisions, and layout choices (x-axis assignment, series arrangement) so renderers only have to draw.
canvas
Canvas renderer for the browser. Uses plotters-canvas::CanvasBackend and the shared draw_on dispatch in crate::draw, so a chart rendered into a <canvas> looks identical to its SVG twin.
kitty
Kitty terminal graphics renderer.
ratatui
Ratatui renderer. Returns a RatatuiChart wrapper that owns the axis strings and f64 datasets that ratatui::widgets::{Chart, BarChart} borrow. The CLI draws it by calling RatatuiChart::draw(&mut frame, area) on its report screen.
spec
Chart intermediate representation.
svg
SVG renderer. Uses plotters’ SVGBackend and the shared draw dispatch in draw.rs so the canvas renderer produces identical layouts.
text
Plain-text chart renderer. Draws ChartSpec as a block of text suitable for the CLI’s log region, terminal stdout, or any context where SVG/canvas/ratatui widgets aren’t available.