StackedBarChart

Columns rise in a wave. Point at one and the rest step back while a card breaks down its parts. Charts.

Open playground
Jan
Feb
Mar
Apr
May
  • Web
  • iOS
  • Android

About

StackedBarChart is a React component in the Charts category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { StackedBarChart } from "@ashutoshswamy/smoui" and set data, series, prefix.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { StackedBarChart } from "@ashutoshswamy/smoui";

<StackedBarChart series={["Web", "iOS"]} data={[{ label: "Jan", parts: [40, 22] }, { label: "Feb", parts: [46, 26] }]} />

Props 3

data

One column each; parts line up with series.

{ label: string; parts: number[] }[]
series

Names for the parts, shown in the legend and card.

string[]
prefix / suffix

Wrap values, or pass `format`.

string