feat: Legend with color-swatch markers for charts
Back to our planProblem
In plain words: a chart needs a key that shows each color (and pattern) next to its meaning. The kit's Legend only draws numbered markers for annotated images.
Summary of the owner's feedback (2026-11-03, Claude in Chrome side panel, text) on the first version of the 2027 budget post: the title is too long and the explanation under it is confusing; the amounts are not grouped in consistent categories, and they don't show how much of the total each one makes up or how this year compares with last year; the icons sit above the text, and the subheader could share a line with the icon. Most importantly, there are not enough visual cues for anyone to follow what is going on, so more diagram elements, charts, infographics and other UI elements are needed, with inventive, unconventional thinking, as if written by someone on a small marketing project who knows nothing about taxes. Design spec and numbers: see #645 and the epic #589.
Today (checked 2026-11-03): src/platform/ui/Legend.tsx (#636) draws numbered orange circles in a drawer that hangs from the image above it.
Proposed fix
- Add
marker: 'number' | 'swatch'(a swatch item is{ label, text, slot, pattern? }: the chart color for its slot, with the hatch pattern when it has one) andattach: 'drawer' | 'none'(noneis a plain list under a chart). Defaults keep today's look. - Swatches are a second cue beyond color (shape or pattern), and the label is always text.
- Native first: our own component. Watch out: shared component used by the Diagram key block; check it renders unchanged.
Acceptance criteria
- Not done: Default look is unchanged (snapshot of the Diagram key).
- Not done: The swatch variant is tested, passes axe and reads as a list; checked at 320 and 1280, light and dark.
- Not done: Gallery entry and
component-set.mdrow updated.
Area
frontend, visualization
Priority
high
Generated by Claude Code, opens in a new tab