Area Chart
The line chart's filled sibling — same config-first, responsive shape, plus a low-opacity fill wash under a full-strength 2px edge line. Pass stacked for cumulative bands, or leave it off for overlapping translucent areas.
| month | Visits |
|---|---|
| Jan | 12.4k |
| Feb | 13.9k |
| Mar | 15.2k |
| Apr | 14.6k |
| May | 16.8k |
| Jun | 18.1k |
| Jul | 19.5k |
| Aug | 18.8k |
| Sep | 21.2k |
| Oct | 23.4k |
| Nov | 24.9k |
| Dec | 27.6k |
Installation
Copy the piece and its math helper into your app — they compile with your build and the code is yours:
puzzle add piece area-chart
chart-math.js is a shared lib file — AreaChart imports it as ../../lib/chart-math.js. It ships alongside the piece; keep it in app/lib/.
Usage
import AreaChart from '@/components/ui/AreaChart.pzl';
<AreaChart data={ data } xKey="month" series={ [{ key: 'visits', label: 'Visits' }] } />Stacked
Direct
Referral
Social
| month | Direct | Referral | Social |
|---|---|---|---|
| Jan | 5.2k | 3.1k | 2.4k |
| Feb | 5.6k | 3.4k | 2.9k |
| Mar | 6.1k | 3.6k | 3.3k |
| Apr | 5.9k | 3.9k | 3.6k |
| May | 6.6k | 4.2k | 4.1k |
| Jun | 7.1k | 4.6k | 4.7k |
| Jul | 7.6k | 4.9k | 5.2k |
| Aug | 7.4k | 5.2k | 5.6k |
| Sep | 8.2k | 5.6k | 6.3k |
| Oct | 8.9k | 6.1k | 7k |
| Nov | 9.4k | 6.6k | 7.6k |
| Dec | 10.2k | 7.1k | 8.4k |
Stacked bands are cumulative, so the top edge reads as the total. The tooltip still shows each channel's own value, not the running sum.
Overlapping
Aurora
Borealis
| month | Aurora | Borealis |
|---|---|---|
| Jan | 8.2k | 5.4k |
| Feb | 8.6k | 6.1k |
| Mar | 9.1k | 6.8k |
| Apr | 8.8k | 7.3k |
| May | 9.6k | 8.1k |
| Jun | 10.2k | 8.9k |
| Jul | 10.8k | 9.6k |
| Aug | 10.5k | 10.1k |
| Sep | 11.4k | 11.2k |
| Oct | 12.1k | 12.4k |
| Nov | 12.8k | 13.6k |
| Dec | 13.5k | 15.1k |
Without stacked, series share the y=0 baseline and their translucent washes overlap — good for comparing two or three magnitudes directly.