/

Stacked Bar Chart

Compare composition across categories with stacked bars. Each bar shows the total, with segments representing parts of the whole.

Usage

example.tsx
import { StackedBarChart } from "@chartts/react"

<StackedBarChart
  data={quarterlyData}
  x="quarter"
  y={["productA", "productB", "productC"]}
  radius={6}
/>

Props

PropTypeDescription
dataT[]Array of data objects
xkeyof TKey for category labels
y(keyof T)[]Keys for stacked values
normalizedbooleanNormalize to 100%. Default: false
radiusnumberBorder radius for bar corners. Default: 4

Features

  • Absolute and normalized (100%) modes
  • Automatic legend
  • Value labels per segment
  • Animated stagger entry
  • Horizontal layout option
  • Custom color per series

Other Charts