Skip to content

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'

On this page
  1. Requests by answer
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

Requests by answer

Requests by answer
Requests per hour, today
  • 2xx answered
  • 3xx redirected
  • 4xx refused
  • 5xx failed
02,0004,0006,00000:0003:0006:0009:0012:0015:0018:0021:00
View as table
Hour2xx answered3xx redirected4xx refused5xx failedTotal
00:001,32020492121,628
01:001,36120994121,676
02:001,481223101121,817
03:001,671245113122,041
04:001,920274127122,333
05:002,209308144122,673
06:002,520344162123,038
07:002,831380180123,403
08:003,120414197123,743
09:003,369443211124,035
10:003,559465223124,259
11:003,679479230124,400
12:003,720484232124,448
13:003,6794792301804,568
14:003,5594654831804,687
15:003,3694432111804,203
16:003,120414197123,743
17:002,831380180123,403
18:002,520344162123,038
19:002,209308144122,673
20:001,920274127122,333
21:001,671245113122,041
22:001,481223101121,817
23:001,36120994121,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
0 GB2.5 GB5 GB7.5 GB10 GBNov 1Nov 5Nov 9Nov 13Nov 17Nov 21Nov 25Nov 29
View as table
DayTablesFilesBackupsTotal
Nov 12 GB1.2 GB0.8 GB4 GB
Nov 22 GB1.3 GB0.8 GB4.2 GB
Nov 32.1 GB1.4 GB0.9 GB4.4 GB
Nov 42.1 GB1.5 GB0.9 GB4.5 GB
Nov 52.2 GB1.6 GB1 GB4.7 GB
Nov 62.3 GB1.6 GB1 GB4.9 GB
Nov 72.3 GB1.7 GB1 GB5.1 GB
Nov 82.4 GB1.8 GB0.8 GB5 GB
Nov 92.4 GB1.9 GB0.8 GB5.2 GB
Nov 102.5 GB2 GB0.9 GB5.3 GB
Nov 112.5 GB2.1 GB0.9 GB5.5 GB
Nov 122.5 GB2.2 GB1 GB5.7 GB
Nov 132.6 GB2.3 GB1 GB5.9 GB
Nov 142.6 GB2.4 GB1 GB6.1 GB
Nov 152.7 GB2.5 GB0.8 GB6 GB
Nov 162.8 GB2.5 GB0.8 GB6.1 GB
Nov 172.8 GB2.6 GB0.9 GB6.3 GB
Nov 182.9 GB2.7 GB0.9 GB6.5 GB
Nov 192.9 GB2.8 GB1 GB6.7 GB
Nov 203 GB2.9 GB1 GB6.9 GB
Nov 213 GB3 GB1 GB7 GB
Nov 223 GB3.1 GB0.8 GB6.9 GB
Nov 233.1 GB3.2 GB0.8 GB7.1 GB
Nov 243.1 GB3.3 GB0.9 GB7.3 GB
Nov 253.2 GB3.4 GB0.9 GB7.5 GB
Nov 263.3 GB3.5 GB1 GB7.7 GB
Nov 273.3 GB3.5 GB1 GB7.8 GB
Nov 283.4 GB3.6 GB1 GB8 GB
Nov 293.4 GB3.7 GB0.8 GB7.9 GB
Nov 303.5 GB3.8 GB0.8 GB8.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

StackedAreaTypeDefault
seriesrequired Series[]
titlerequired ReactNode
xrequired

The positions along the horizontal axis: dates, hours.

string[]
empty ReactNode
error ReactNode
formatValue Fmt
height number
loading boolean
subtitle

What is plotted and in what unit: «Requests per minute, last 24 hours».

ReactNode
xLabel

The header of the first column of the table view: what `x` is.

string
ChartSkeletonTypeDefault
height number 240
legend

How many series the legend will list.

number 0
table

Whether the chart will offer «View as table» under the plot (every LineChart, AreaChart and BarChart does).

boolean true
  1. Requests by answer
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms