facett_plotters/lib.rs
1//! **facett-plotters** — the chart types [`egui_plot`](https://docs.rs/egui_plot)
2//! (→ `facett-plot`) *lacks*, painted in **immediate mode** directly on an
3//! [`egui::Painter`]. `egui_plot` already covers line/scatter/bar/histogram with
4//! zoom/pan; this crate fills the analytics long-tail Plotly defines:
5//!
6//! - [`BoxPlotView`] — quartiles + 1.5·IQR whiskers + outliers
7//! - [`ViolinView`] — Gaussian-KDE density silhouette
8//! - [`HeatmapView`] — a matrix as a colour grid with a gradient legend
9//! - [`CandlestickView`] — OHLC bars (wick + body)
10//! - [`TreemapView`] — weighted slice-and-dice rectangles
11//!
12//! ## Why hand-rolled, not the `plotters` crate
13//! The `plotters` crate is **retained + raster/SVG-backend driven**: its egui
14//! integration renders to a bitmap and blits a texture every frame, with no
15//! immediate-mode hit-testing, no live theming, and no hover model. facett's
16//! charts must read [`facett_core::theme`] live (re-skin on theme switch),
17//! expose cheap hover-readouts, and implement the [`Facet`](facett_core::Facet)
18//! contract (`caps()` + `copy()` → CSV). Hand-painting on the egui `Painter`
19//! (the same path `facett-core`/`facett-map` use) is the lighter, better-fitting
20//! choice — so `plotters` is *not* a dependency.
21//!
22//! ## Theme-derived colour ramps
23//! No palette is hardcoded. [`ramp::Ramp`] builds a **sequential**
24//! (`bg`→`accent`→`glow`) or **diverging** (`accent`→`text_dim`→`glow`) ramp
25//! purely from the active [`Theme`](facett_core::Theme), so heatmaps/treemaps
26//! follow whatever theme is set.
27//!
28//! Each view is a [`Facet`](facett_core::Facet): it declares
29//! `caps().themeable().copyable().resizable()`, paints itself, and `copy()`
30//! emits the underlying data as CSV. The data→geometry math (quartiles, KDE
31//! bins, OHLC mapping, heatmap cell layout, treemap squarify) lives in **pure,
32//! tested functions** that need no GPU.
33
34pub mod boxplot;
35pub mod candlestick;
36pub mod heatmap;
37pub mod ramp;
38pub mod treemap;
39pub mod violin;
40
41pub use boxplot::{BoxPlotView, Quartiles};
42pub use candlestick::{CandlestickView, Ohlc, OhlcLayout};
43pub use heatmap::HeatmapView;
44pub use ramp::Ramp;
45pub use treemap::{Tile, TreemapView};
46pub use violin::{Density, ViolinView};