Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/facett

facett-plotters/.nornir/design.md

facett-plotters — the everyday XY chart (line · bar · scatter) as one Elm Facet

Class: design · What it IS: [ChartView] — a single themeable [Facet] that draws line, bar, or scatter over a set of named series, with the axes, gridlines, legend, and hover tooltip all derived from the data. It lives alongside the crate's hand-painted analytics charts (box/violin/heatmap/ candlestick/treemap) and, like them, is drawn in immediate mode on the egui Painter — no egui_plot, no retained plotters crate. Sibling how-to: guide.md. This file states only what it is.

Function axis

The Elm split (f4)

Colour — the categorical job, done right

Series are identity-coded, so [palette] supplies a small validated categorical set (the dataviz reference palette: eight hues in a fixed order that maximises the minimum adjacent CVD separation), assigned by slot index and cycling only past the eighth. It is not a per-string hash: identity follows the slot, so a series keeps its colour regardless of how many others are present. Which column (light-surface vs dark-surface steps of the same eight hues) is used follows the theme's surface luminance — so the palette re-skins with the theme without ever baking a colour into the component. Text (axis ticks, legend labels) wears the theme ink; only the legend swatch and the mark carry the series colour.

Introspection (the robot seam)

state_json is richer than the raw model (Form 3): it adds series_count, the derived x_bounds/y_bounds, and a per-series {label, points} summary a robot reads without rendering. update_json deserializes a Msg straight through update. The robot test drives the full loop headless: feed series → assert count + bounds → set_kind → assert the kind flipped (line→bar→scatter). Each painted series/bar also rides into the AccessKit tree via facett_core::a11y::node (FC-4) carrying its point count / y value, so egui_kittest can query it.

Constraints