Skip to content

StackedBar

Bars stacked to show a total and its parts in each period. It is BarChart with stacked.

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

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

Storage by kind

Storage by kind
GB, per month
  • Database
  • Files
  • Backups
0204060JulAugSepOctNov
View as table
DatabaseFilesBackups
Jul1263
Aug1473
Sep1794
Oct19124
Nov23135
Code
import { BarChart } from '@sypnia/ui/react';

// Bars stacked to show a total and its parts in each period.
export default function Parts() {
  return <BarChart stacked title="Storage by kind" subtitle="GB, per month" x={['Jul', 'Aug', 'Sep', 'Oct', 'Nov']}
    series={[{ id: 'db', label: 'Database', data: [12, 14, 17, 19, 23] }, { id: 'files', label: 'Files', data: [6, 7, 9, 12, 13] }, { id: 'backups', label: 'Backups', data: [3, 3, 4, 4, 5] }]} />;
}

When to use it

Use it when

  • Totals whose parts matter: storage by kind.

Do not use it when

  • Comparing the middle parts: only the bottom one starts at zero.

For everyone

  • The tooltip and the table give every part in numbers.

Props

BarChartTypeDefault
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
stacked

Series on top of each other (parts of a total) instead of side by side.

boolean false
subtitle ReactNode
xLabel

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

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

    Search pages, sections and terms