Skip to content

AreaChart

A line with a light wash under it, for a quantity that accumulates: storage used, total sign-ups. Two or more series get a legend.

import { AreaChart } from '@sypnia/ui/react'

On this page
  1. Storage used
  2. When to use it
  3. For everyone
  4. Props

Storage used

Storage used
Last 8 weeks
  • Database
  • Files
0 B191 MB381 MB572 MB763 MBW1W2W3W4W5W6W7W8
View as table
WeekDatabaseFiles
W1114 MB38 MB
W2172 MB57 MB
W3248 MB86 MB
W4296 MB143 MB
W5401 MB153 MB
W6448 MB210 MB
W7534 MB248 MB
W8582 MB286 MB
Code
import { AreaChart, useSypnia } from '@sypnia/ui/react';

// A quantity that accumulates: the wash under the line says «this much, so far».
export default function Storage() {
  const { format } = useSypnia();
  return <AreaChart title="Storage used" subtitle="Last 8 weeks" xLabel="Week" x={['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8']}
    formatValue={(v) => format.bytes(v * 1e6)} series={[{ id: 'db', label: 'Database', data: [120, 180, 260, 310, 420, 470, 560, 610] }, { id: 'files', label: 'Files', data: [40, 60, 90, 150, 160, 220, 260, 300] }]} />;
}

When to use it

Use it when

  • Totals that grow over time.

Do not use it when

  • Rates and percentages: use LineChart.
  • More than three series: the washes cover each other.

For everyone

  • Hover or focus to read every series at a point; the table has all the numbers.

Props

AreaChartTypeDefault
seriesrequired Series[]
titlerequired ReactNode
xrequired

The positions along the horizontal axis: dates, hours, names.

string[]
empty ReactNode
error ReactNode
formatValue

How a value is written in ticks, tooltip and table. Defaults to a compact number in the person's language.

((v: number) => string)
height number
loading boolean
subtitle ReactNode
xLabel

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

string
  1. Storage used
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms