feat: visx bar and stacked-bar adapter with a shared scale and scroll reveal
Back to our planProblem
In plain words: to show "last year next to this year" and "borrowed vs other money", the site needs bar charts that share one scale, with the increase marked in a way that doesn't say good or bad.
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): no chart code exists. #639 builds the chart core (port, registry, text and CSS adapters); this adds the first visx drawing on top of it.
Proposed fix
src/platform/ui/chart/adapters/visx/: kindsbar(horizontal) andstacked(horizontal,BarStackHorizontal); more kinds stay in #642 and #639's later work. visx stays in this folder only (lint policy from #639).- Spike first, in the PR's first commit:
next buildshows no@visxmodule in any client chunk; if it does, stop and report on #592. scaleMaxshares one scale across charts (for example $0 to $500M);rowNotesadds a line per row (for example "$66 of every $100 borrowed");hatchnames the series drawn with the hatch pattern (an increase, borrowed money), through@visx/pattern. No red or green for direction.- Reveal on scroll: CSS only, final state by default, wrapped in
@media (prefers-reduced-motion: no-preference) { @supports (animation-timeline: view()) { … } }(achart-reveal-xutility defined once intailwind.css). Browsers without support show the finished chart. - Passes the adapter contract (
describeChartAdapter) forsvgoutput; gallery at six widths, light and dark. - Native first, one line per step: (1) React server components and SVG; (2) no official plugin; (3) visx 4.0.0, chosen on #592; (4) our spec, adapters and tests.
Acceptance criteria
- Not done: No
@visxcode in any client chunk (build output pasted in the PR). - Not done: The contract test passes for
barandstacked; labels and values are text; axe passes. - Not done: Two charts with the same
scaleMaxdraw bars to the same scale (test). - Not done: With reduced motion, and in a browser without scroll-driven animation, the chart is fully drawn at load.
- Not done: Gallery at 320, 430, 768, 1024, 1280 and 1920, light and dark, no overflow.
Area
frontend, visualization
Priority
high
Generated by Claude Code, opens in a new tab