Skip to content

No.249 · Analytics

Waterfall Bridge

How a quarter's revenue became its profit: each cost hangs down from where the last step left off and each gain stacks up, joined by connectors, building in order the first time you see it; switch quarter and every bar slides to its new height so you can watch which step moved.

The prompt

The design brief behind this component — reuse it to regenerate, remix, or explain it.

Build a profit waterfall (bridge) chart in SVG for two quarters. Data: steps from Revenue (a total) through costs (negative) and other income (positive) to Net profit (a total computed from the rest). Each non-total step runs from the running total to running total + value; totals stand on zero. Bars are 4px-rounded, at most 64px wide; a dashed hairline connector joins each bar's end level to the next bar. Colour by polarity on the diverging pair — gains in the blue pole, losses in the red pole — and totals in a neutral ink tone, never status colours; every bar also carries a signed value label (+18.5k / −131k), so the sign is never colour alone. Labels sit above gains and totals, below losses. A shared nice y-axis across both quarters so switching doesn't rescale. Motion: on first view each step fades and rises into place 140ms after the last (a build). Switching quarter (a Q2/Q3 radiogroup) tweens every bar's start and end to its new place (640ms ease-in-out) so the steps that moved are visible. Hover dims the other steps and shows a tooltip (value, share of revenue, the other quarter's value). Header: net profit as the hero, its change vs the other quarter with ▲/▼ and success/critical text tokens, the margin, and the biggest swing between quarters computed from the data. Legend (Total / Adds to profit / Takes away). Chart ⇄ Table (both quarters and the change per step). Under 600px the step names are angled −40° and value labels shrink so nothing collides. Light and dark themes. Reduced motion: no build or tween.

Notes

Interaction
Switch quarter to watch the bars move; point at a step for its share of revenue and last quarter's value; Table for the numbers.
Motion
Build: 140ms per step; quarter switch: 640ms tween of every bar.
Accessibility
Signed value labels on every bar, a legend, a sentence summary on the SVG and a full table; the quarter switch is a radiogroup.
Responsive
Width follows the container; step names angle under 600px.
On touch
Tap a step for its tooltip.

Featured

301 components