Bar Chart

Compares values across categories as columns or bars, grouped or stacked.
Stable
Web
iOS
Android
@advui/charts
Source

One series

People reached by stateQ3 2026, all sectors

Installation

pnpm
pnpm add @advui/charts
npm
npm install @advui/charts

Usage

import { BarChart } from '@advui/charts'

<BarChart
  title="People reached by state"
  data={[{ state: 'Kachin', reached: 182000 }, { state: 'Shan', reached: 246000 }]}
  index="state"
  series={[{ key: 'reached', label: 'People reached' }]}
/>

Examples

Grouped

Planned vs reached, by sectorThousands of people, 2026
Planned
Reached

Stacked, horizontal

Active organizations by townshipBy organization type
UN
INGO
NGO

API reference

BarChart

PropTypeDefaultDescription
title requiredstring—Names the chart: its heading and accessible name.
descriptionstring—Muted line under the title (units, period).
data requiredT[]—One object per category or x position. Its type `T` (an interface works) is inferred, and `index` and `series` must name its fields.
index requiredkeyof T & string—Field holding each row’s label.
indexLabelstring`index`Heading of the label column in the table view.
series required{ key: keyof T & string; label: string }[]—Numeric fields to plot. Colors follow this order (`chart1`…`chart8`), never the values. An array declared apart from the chart needs `as const` to keep its keys literal.
layout'vertical' | 'horizontal''vertical'`horizontal` bars suit long category names.
stackedbooleanfalseOne bar per category, split by series (part-to-whole).
valueFormatter(value: number) => string—Formats tooltip and table values. Axis ticks are compact (1.2K).
heightnumber240Pixels, including the axes.
widthnumber—Fixed width. By default it fills its container.
labelsPartial<ChartLabels>—"Show table", "Hide table" and the keyboard hint, for translation.

Accessibility

  • The chart is a figure named by its title. The plot is one focusable image whose name gives the title, description and a hint; the arrow keys (Home / End too) step through the values, which a polite live region reads out.
  • Every chart has a table view ("Show table") with the same values, so nothing depends on seeing colors or hovering.
  • Identity never relies on color alone: two or more series get a legend, and the tooltip names each value.
  • Colors come from the chart1…chart8 theme keys, a palette checked for color-blind separation in light and dark mode.
Keyboard interactions
KeyAction
TabFocuses the plot, then the table button.
Arrow keys / Home / EndMove between values and read them.
EscapeHides the tooltip.

Responsive behavior

Fills its container; category labels thin out when they would overlap. Use horizontal for long names on phones.

Platform notes

Web
SVG in the page. Hover shows the tooltip; the arrow keys work once the plot has focus.
iOS
Drawn with react-native-svg. Tap the plot to show the tooltip for that point. VoiceOver and TalkBack read the title and description, without the arrow-key hint; Show table lists every value.
Android
Same as iOS.
Since v0.6.0Last updated Nov 2, 2026Edit this page on GitHub