ADR 024: Console charts stay on the in-house SVG components
- Status: Accepted
- Owner: Eng lead
- Date: 2026-11-14
Context
The console needs time-series (single and multi-series), comparison bars, stacked breakdowns and utilization meters, with tooltips, keyboard access, a table alternative, light and dark themes and small bundles. The console's design system (@lynkoria/brand plus apps/admin/src/lib) already ships a daily BarChart and Sparkline written as plain React SVG on the brand's series tokens. Series are short: at most 400 daily or 168 hourly points per series and a handful of series.
Options
| Option | For | Against |
|---|---|---|
| Extend the in-house SVG set | Already themed with brand tokens; no dependency; tiny bundle | We own tooltip, axis and accessibility code |
| Recharts (shadcn charts) | Common, React-first | Not part of this design system (no shadcn); ~100 kB gzipped; theming through props; v3 accessibility layer still maturing |
| Apache ECharts | Large-data performance, zoom | Canvas by default (weaker screen-reader story), separate theming system, large even with modular imports |
| Visx | Primitives, small | Still builds most of what we already have |
The volumes do not need canvas rendering or zoom: the range filter replaces zooming, and 400 points render in SVG without measurable cost.
Decision
Extend the existing SVG components in apps/admin/src/lib/chart.tsx and use no chart library. Every chart: brand series tokens (never color alone; series also differ by dash pattern or label), a hover and focus tooltip, an accessible summary (<title>), a "show as table" alternative, and explicit loading, empty, unavailable and error states.
Consequences
Adding a fundamentally new chart type (for example a heatmap) means writing it. Revisit if the console ever needs more than about 5 000 points per chart or interactive zooming.