No.418 · Analytics
Sankey Flow
Where visitors come from, where they go and how it ends, as flows whose width is the number of people; point at a band to follow just those people.
The prompt
Written for the variant you picked above: Light
Build a three-column Sankey diagram in SVG with no chart library: sources (Search, Social, Direct, Email) → pages (Destinations, Deals, Guides) → outcomes (Booked, Saved, Left). Scale every node and band to the number of people (all columns share one scale; 14px gaps between nodes; columns vertically centred). Stack each node's bands in the order of the nodes at their other end, so bands don't cross needlessly; each band is a filled shape between two cubic curves (control points at the horizontal midpoint). Colour carries meaning only where it's true: first-stage bands take their source's colour (a fixed series order from a colour-blind-checked palette); later bands are neutral grey, and bands into the goal (Booked) are drawn darker. Bands are translucent (32%, 50% into the goal). The headline is the takeaway — "28% of 19,600 visitors booked". Nodes are thin rounded bars with the name and value beside them (inside the frame, right-aligned for the last column). Pointing at a band shows "Search → Deals: 2,400 visitors (26% of Search)" and dims everything else; pointing at a node keeps only its bands. The first time it scrolls into view the bands draw in from the left, column by column (clip-path, 900ms, 220ms per column). A Table button swaps in a from/to/visitors table. Selected variant — Light (light): Palette for this theme (Light): --grid #e9e8e2; --ink #0b0b0b; --ink-2 #52514e; --muted #898781; --ring rgba(11, 11, 11, 0.1); --surface #fcfcfb. Treat these as the root colour tokens, one value per role, and name them to suit your code. Select it with the theme option set to "light". Keep every dimension, spacing value, state and motion from the brief unchanged, and keep text at 4.5:1 contrast or better on these surfaces. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Point at a band or a node to isolate those visitors; use Table for exact numbers. Motion: Bands draw in from the left on first view (900ms, staggered by column); highlights fade in 220ms. Accessibility: The SVG has a summary label, the hint line is a polite live region, and a full table view is available. Colour is never the only key: every node is labelled. Reduced motion shows the bands immediately. Responsive behavior: The diagram scales with its width; labels sit inside the frame at every size. Touch: Tap a band or node to isolate it; the table covers precise reading. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.
Notes
- Interaction
- Point at a band or a node to isolate those visitors; use Table for exact numbers.
- Motion
- Bands draw in from the left on first view (900ms, staggered by column); highlights fade in 220ms.
- Accessibility
- The SVG has a summary label, the hint line is a polite live region, and a full table view is available. Colour is never the only key: every node is labelled. Reduced motion shows the bands immediately.
- Responsive
- The diagram scales with its width; labels sit inside the frame at every size.
- On touch
- Tap a band or node to isolate it; the table covers precise reading.