No.419 · Analytics
Pulse Line
Revenue over time, the way a good dashboard opens: the line draws itself over a soft area, the previous period sits behind as a dashed ghost, the peak and latest day are labelled in place, ranges morph the line into its new shape, and a magnetic crosshair reads any day against last period.
The prompt
Written for the variant you picked above: Light
Build a revenue line chart (SVG, one y-axis) with a hero figure and a period comparison. Header: the title, the total for the range as a hero number that counts to its new value (700ms), and a delta vs the previous period with a ▲/▼ icon and text in the success/critical text tokens (never colour alone). Controls in one row: a 7D/30D/90D/12M segmented radiogroup (12M aggregates to months) and a Chart ⇄ Table toggle. A legend: "This period" (series slot 1, solid 2px) and "Previous period" (muted, dashed). Curve: both series are interpolated with a monotone cubic (Fritsch–Carlson, so it never overshoots) and sampled at 72 positions, so switching ranges tweens every sample and the nice y-axis maximum (520ms ease-out) — the line morphs into its new shape instead of blinking. A 20% → 0 gradient area sits under the line; the previous period is a 1.5px dashed muted line. Recessive chrome: hairline gridlines, a baseline, muted tabular tick labels (4–6 x ticks by width). On first view a clip rect sweeps left to right (1.1s) to draw it in; then the peak and the latest point get dots (surface ring) and direct labels ("Peak 4.2k", "Latest 3.6k") with a surface halo. Hover: pointer x snaps to the nearest real point (magnetic): a vertical hairline, a ringed dot on each line and a tooltip (date, value, previous, ±% with arrow) that flips side near the right edge. Keyboard: the plot is focusable; ←/→ move, Home/End, Esc clears. Accessibility: role="img" with a sentence summary; the Table view lists every point (sticky header, tabular numbers). Palette: the validated reference slot 1 (#2a78d6 light / #3987e5 dark), ink tokens for all text, light and dark themes each with their own surface and steps. Reduced motion: no tweening, counting or draw-in. Selected variant — Light (light): Palette for this theme (Light): --axis #c3c2b7; --down #d03b3b; --grid #e1e0d9; --ink #0b0b0b; --ink-2 #52514e; --muted #898781; --ring rgba(11, 11, 11, 0.1); --s1 #2a78d6; --surface #fcfcfb; --up #006300. 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: Pick a range; move along the line (or focus it and use ← →) to read any day; Table shows the numbers. Motion: Draw-in 1.1s on first view; range morph 520ms; hero count 700ms. Accessibility: Sentence summary on the SVG, keyboard crosshair, a full table view, deltas carry an arrow and text as well as colour. Responsive behavior: Width follows the container (ResizeObserver); x ticks thin out under 520px; the header wraps. Touch: Drag along the chart to move the crosshair; the page still scrolls vertically. 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
- Pick a range; move along the line (or focus it and use ← →) to read any day; Table shows the numbers.
- Motion
- Draw-in 1.1s on first view; range morph 520ms; hero count 700ms.
- Accessibility
- Sentence summary on the SVG, keyboard crosshair, a full table view, deltas carry an arrow and text as well as colour.
- Responsive
- Width follows the container (ResizeObserver); x ticks thin out under 520px; the header wraps.
- On touch
- Drag along the chart to move the crosshair; the page still scrolls vertically.