pub fn render_chart(
series: &[(&str, &[(f64, f64)])],
width_cells: usize,
height_cells: usize,
style: CanvasStyle,
) -> StringExpand description
Render one or more named (label, points) series into a single framed chart.
- Axis ranges are auto-scaled from the data: min/max
xand min/maxyacross every series. Theyrange and every series label are printed on the top border; thexrange is printed on the bottom border — “framed chart string with x/y axis ranges printed on the border”, per the ticket. - Points are plotted as dots only; there is no line interpolation between consecutive samples. Dense series (trajectory integration output, which this is built for, easily has hundreds to thousands of points over a 72-cell-wide canvas) render as a continuous-looking curve purely from sample density; sparse series will look like literally scattered dots. Adding Bresenham-style line segments was considered and dropped: it’s not needed for the trajectory use case and would be extra surface to get right for no visible benefit there.
width_cells/height_cellssize only the PLOT AREA. The returned string iswidth_cells + 2characters wide (a left/right frame column) andheight_cells + 2lines tall (top/bottom frame rows), with no trailing newline.- A degenerate axis (every point shares the same
x, or the samey) is expanded by ±0.5 around that single value so the scale never divides by zero. - Non-finite (
NaN/inf) coordinates are skipped entirely — they neither affect the autoscale range nor get plotted — rather than corrupting the whole chart’s scale.