StackedArea
Parts of a total over time, one on top of the other: requests by answer, storage by kind. The top edge is the total.
import { StackedArea, ChartSkeleton } from '@sypnia/ui/react'
Requests by answer
Requests by answer
Requests per hour, today
- 2xx answered
- 3xx redirected
- 4xx refused
- 5xx failed
View as table
| Hour | 2xx answered | 3xx redirected | 4xx refused | 5xx failed | Total |
|---|---|---|---|---|---|
| 00:00 | 1,320 | 204 | 92 | 12 | 1,628 |
| 01:00 | 1,361 | 209 | 94 | 12 | 1,676 |
| 02:00 | 1,481 | 223 | 101 | 12 | 1,817 |
| 03:00 | 1,671 | 245 | 113 | 12 | 2,041 |
| 04:00 | 1,920 | 274 | 127 | 12 | 2,333 |
| 05:00 | 2,209 | 308 | 144 | 12 | 2,673 |
| 06:00 | 2,520 | 344 | 162 | 12 | 3,038 |
| 07:00 | 2,831 | 380 | 180 | 12 | 3,403 |
| 08:00 | 3,120 | 414 | 197 | 12 | 3,743 |
| 09:00 | 3,369 | 443 | 211 | 12 | 4,035 |
| 10:00 | 3,559 | 465 | 223 | 12 | 4,259 |
| 11:00 | 3,679 | 479 | 230 | 12 | 4,400 |
| 12:00 | 3,720 | 484 | 232 | 12 | 4,448 |
| 13:00 | 3,679 | 479 | 230 | 180 | 4,568 |
| 14:00 | 3,559 | 465 | 483 | 180 | 4,687 |
| 15:00 | 3,369 | 443 | 211 | 180 | 4,203 |
| 16:00 | 3,120 | 414 | 197 | 12 | 3,743 |
| 17:00 | 2,831 | 380 | 180 | 12 | 3,403 |
| 18:00 | 2,520 | 344 | 162 | 12 | 3,038 |
| 19:00 | 2,209 | 308 | 144 | 12 | 2,673 |
| 20:00 | 1,920 | 274 | 127 | 12 | 2,333 |
| 21:00 | 1,671 | 245 | 113 | 12 | 2,041 |
| 22:00 | 1,481 | 223 | 101 | 12 | 1,817 |
| 23:00 | 1,361 | 209 | 94 | 12 | 1,676 |
Code
import { StackedArea } from '@sypnia/ui/react';
// Parts of a total over time: the top edge is the total. Move the pointer, or focus the chart and use the arrows.
const hours = Array.from({ length: 24 }, (_, h) => `${String(h).padStart(2, '0')}:00`);
const wave = (h: number, base: number, amp: number) => Math.round(base + amp * Math.sin(((h - 6) / 24) * 2 * Math.PI) + amp * 0.6);
export default function Status() {
return (
<StackedArea title="Requests by answer" subtitle="Requests per hour, today" xLabel="Hour" x={hours} series={[
{ id: '2xx', label: '2xx answered', data: hours.map((_, h) => wave(h, 1800, 1200)) },
{ id: '3xx', label: '3xx redirected', data: hours.map((_, h) => wave(h, 260, 140)) },
{ id: '4xx', label: '4xx refused', data: hours.map((_, h) => wave(h, 120, 70) + (h === 14 ? 260 : 0)) },
{ id: '5xx', label: '5xx failed', data: hours.map((_, h) => (h >= 13 && h <= 15 ? 180 : 12)) },
]} />
);
} Skeleton
Storage by kind over a month, and the chart before its data.
Storage
By kind, November 2026
- Tables
- Files
- Backups
View as table
| Day | Tables | Files | Backups | Total |
|---|---|---|---|---|
| Nov 1 | 2 GB | 1.2 GB | 0.8 GB | 4 GB |
| Nov 2 | 2 GB | 1.3 GB | 0.8 GB | 4.2 GB |
| Nov 3 | 2.1 GB | 1.4 GB | 0.9 GB | 4.4 GB |
| Nov 4 | 2.1 GB | 1.5 GB | 0.9 GB | 4.5 GB |
| Nov 5 | 2.2 GB | 1.6 GB | 1 GB | 4.7 GB |
| Nov 6 | 2.3 GB | 1.6 GB | 1 GB | 4.9 GB |
| Nov 7 | 2.3 GB | 1.7 GB | 1 GB | 5.1 GB |
| Nov 8 | 2.4 GB | 1.8 GB | 0.8 GB | 5 GB |
| Nov 9 | 2.4 GB | 1.9 GB | 0.8 GB | 5.2 GB |
| Nov 10 | 2.5 GB | 2 GB | 0.9 GB | 5.3 GB |
| Nov 11 | 2.5 GB | 2.1 GB | 0.9 GB | 5.5 GB |
| Nov 12 | 2.5 GB | 2.2 GB | 1 GB | 5.7 GB |
| Nov 13 | 2.6 GB | 2.3 GB | 1 GB | 5.9 GB |
| Nov 14 | 2.6 GB | 2.4 GB | 1 GB | 6.1 GB |
| Nov 15 | 2.7 GB | 2.5 GB | 0.8 GB | 6 GB |
| Nov 16 | 2.8 GB | 2.5 GB | 0.8 GB | 6.1 GB |
| Nov 17 | 2.8 GB | 2.6 GB | 0.9 GB | 6.3 GB |
| Nov 18 | 2.9 GB | 2.7 GB | 0.9 GB | 6.5 GB |
| Nov 19 | 2.9 GB | 2.8 GB | 1 GB | 6.7 GB |
| Nov 20 | 3 GB | 2.9 GB | 1 GB | 6.9 GB |
| Nov 21 | 3 GB | 3 GB | 1 GB | 7 GB |
| Nov 22 | 3 GB | 3.1 GB | 0.8 GB | 6.9 GB |
| Nov 23 | 3.1 GB | 3.2 GB | 0.8 GB | 7.1 GB |
| Nov 24 | 3.1 GB | 3.3 GB | 0.9 GB | 7.3 GB |
| Nov 25 | 3.2 GB | 3.4 GB | 0.9 GB | 7.5 GB |
| Nov 26 | 3.3 GB | 3.5 GB | 1 GB | 7.7 GB |
| Nov 27 | 3.3 GB | 3.5 GB | 1 GB | 7.8 GB |
| Nov 28 | 3.4 GB | 3.6 GB | 1 GB | 8 GB |
| Nov 29 | 3.4 GB | 3.7 GB | 0.8 GB | 7.9 GB |
| Nov 30 | 3.5 GB | 3.8 GB | 0.8 GB | 8.1 GB |
Code
import { ChartSkeleton, StackedArea } from '@sypnia/ui/react';
// Storage by kind over a month, in gigabytes; and the skeleton the chart has before its data.
const days = Array.from({ length: 30 }, (_, i) => `Nov ${i + 1}`);
export default function Storage() {
return (
<div className="sy-stack">
<StackedArea title="Storage" subtitle="By kind, November 2026" xLabel="Day" x={days} formatValue={(v) => `${Number(v.toFixed(1))} GB`} series={[
{ id: 'tables', label: 'Tables', data: days.map((_, i) => +(2 + i * 0.05).toFixed(2)) },
{ id: 'files', label: 'Files', data: days.map((_, i) => +(1.2 + i * 0.09).toFixed(2)) },
{ id: 'backups', label: 'Backups', data: days.map((_, i) => +(0.8 + (i % 7) * 0.04).toFixed(2)) },
]} />
<ChartSkeleton legend={3} />
</div>
);
} When to use it
Use it when
- Up to five parts of one total that change over time.
- Fold a sixth part and beyond into «Other»: colours never repeat or get invented.
Do not use it when
- Comparing the parts with each other: use LineChart, where each starts at zero.
- Values of different units: one chart each.
For everyone
- Focus the chart and use the arrow keys: the tooltip and a live line read every part and the total.
- The legend names every part; «View as table» has all the numbers.
Props
| StackedArea | Type | Default |
|---|---|---|
seriesrequired | Series[] | |
titlerequired | ReactNode | |
xrequiredThe positions along the horizontal axis: dates, hours. | string[] | |
empty | ReactNode | |
error | ReactNode | |
formatValue | Fmt | |
height | number | |
loading | boolean | |
subtitleWhat is plotted and in what unit: «Requests per minute, last 24 hours». | ReactNode | |
xLabelThe header of the first column of the table view: what `x` is. | string |
| ChartSkeleton | Type | Default |
|---|---|---|
height | number | 240 |
legendHow many series the legend will list. | number | 0 |
tableWhether the chart will offer «View as table» under the plot (every LineChart, AreaChart and BarChart does). | boolean | true |