Skip to content

GroupedBar

Bars side by side, one per series, in each period: compare the series period by period. It is BarChart with two or more series.

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

On this page
  1. Sign-ups by plan
  2. When to use it
  3. For everyone
  4. Props

Sign-ups by plan

Sign-ups by plan
Per month
  • Free
  • Pro
0100200300JulAugSepOctNov
View as table
FreePro
Jul12030
Aug15042
Sep14038
Oct19055
Nov21061
Code
import { BarChart } from '@sypnia/ui/react';

// Bars side by side to compare series in each period.
export default function Compare() {
  return <BarChart title="Sign-ups by plan" subtitle="Per month" x={['Jul', 'Aug', 'Sep', 'Oct', 'Nov']}
    series={[{ id: 'free', label: 'Free', data: [120, 150, 140, 190, 210] }, { id: 'pro', label: 'Pro', data: [30, 42, 38, 55, 61] }]} />;
}

When to use it

Use it when

  • Comparing a few series in each period.

Do not use it when

  • More than three series: the groups get thin.
  • Parts of a total: use StackedBar.

For everyone

  • Hover or focus a bar to read every series of that period; the table has all.

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. Sign-ups by plan
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms