Skip to content

Bar Chart

ChartsSince 0.3.0

An accessible SVG bar chart for comparing values across categories. It provides:

  • vertical bars (columns) or horizontal bars;
  • grouped (side by side) or stacked series; negative values grow down (or leftward) from zero, and stacked positives and negatives diverge from the zero baseline;
  • gaps for missing values and optional printed value labels;
  • a legend of toggle buttons; keyboard-reachable bars (one tab stop, arrow keys) with a tooltip on focus and hover (hover shows every series of the category and, when stacked, the total);
  • a generated summary and a data table fallback (with a Total column when stacked);
  • per-series textures (with patterns) so series never differ by color alone (WCAG 1.4.1).
  • Grouped or stackedVertical or horizontal bars, side by side or stacked, with negative values diverging from zero.
  • Keyboard barsOne tab stop; arrow keys move between bars with a tooltip on focus and hover.
  • Legend togglesLegend buttons show and hide series.
  • Data table fallbackA generated summary and a data table, with a Total column when stacked.
  • TexturesOptional patterns so series never differ by color alone.

Use it for

  • Comparing values across discrete categories.
  • Stacked: showing totals and their composition.
  • Horizontal: long category labels or many categories.

Use something else for

  • Trends over continuous time: use Line Chart.
  • A single part-to-whole breakdown with few parts: Pie Chart may read faster.
  • Exact lookup of many values: use Data Table.
Anatomy
<div class="aui-chart aui-bar-chart [aui-bar-chart--horizontal] [aui-bar-chart--stacked] [aui-chart--patterns]">
<div class="aui-chart__header">title, description</div>
<ul class="aui-chart__legend" aria-label="Legend">toggle buttons with texture swatches</ul>
<div class="aui-chart__body">
<svg class="aui-chart__svg" role="group" aria-roledescription="column chart" aria-labelledby="T" aria-describedby="S">
<defs><pattern .../></defs>
<g class="aui-chart__grid" aria-hidden="true"/> <g class="aui-chart__axis …" aria-hidden="true"/>
<g class="aui-bar-chart__bars">
<g class="aui-bar-chart__series aui-chart__series--c2">
<rect class="aui-chart__mark aui-bar-chart__bar" role="img" aria-label="Europe, Closed: 96"/>
<rect class="aui-chart__pattern" fill="url(#pattern)" aria-hidden="true"/>
</g>
</g>
<g class="aui-bar-chart__labels" aria-hidden="true">value labels</g>
</svg>
<div class="aui-chart__tooltip" aria-hidden="true" hidden/>
</div>
<p class="aui-chart__summary" hidden/> <div class="aui-chart__data">Show data table, table</div>
</div>

Use the bar above each frame to switch theme, density, direction, and locale.

The part of the Sales report showcase that uses Bar Chart. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.

Showcase source
// Basic charts showcase: a sales report with a line chart (zoom, a dashed plan series, a target
// band), grouped or stacked bars (reference line, zoom), a donut, a bar chart whose crosshair is
// synchronized with the trend, sparklines, and SVG or PNG export. Legend, data table, patterns,
// style, and animation are switchable; point clicks are logged.
import { BarChart } from '@absoluteui/components/bar-chart';
import { downloadChart } from '@absoluteui/components/chart-export';
import { LineChart } from '@absoluteui/components/line-chart';
import { PieChart } from '@absoluteui/components/pie-chart';
import { Sparkline } from '@absoluteui/components/sparkline';
import { action, chartControls, chartLook, choice, createShowcase, hostIn, section, toggle } from './kit.js';
const sc = createShowcase({
title: 'Sales report',
description: 'Hover or use the arrow keys on a chart for values (the trend and the orders chart follow each other), click or press Enter on a point, toggle series in the legend, change the style, zoom, and export a chart.',
});
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const wave = (base: number, amp: number, phase: number): number[] => MONTHS.map((_, i) => Math.round(base + amp * Math.sin(i / 2 + phase) + i * 4));
const eur = { style: 'currency', currency: 'EUR', notation: 'compact' } as const;
const trend = section(sc, 'Monthly revenue', ['line-chart', 'bar-chart']);
const line = LineChart.create(hostIn(trend), {
label: 'Monthly revenue by region',
description: 'Thousands of euros, 2026.',
x: MONTHS,
series: [
{ id: 'emea', label: 'EMEA', values: wave(120, 18, 0) },
{ id: 'apac', label: 'APAC', values: wave(90, 22, 1) },
{ id: 'amer', label: 'Americas', values: wave(150, 15, 2) },
{ id: 'plan', label: 'Plan (Americas)', values: MONTHS.map((_, i) => 150 + i * 5), style: { dash: 'dashed', marker: 'none', lineWidth: 1.5 } },
],
valueFormat: { ...eur, maximumFractionDigits: 0 },
annotations: [{ type: 'band', axis: 'x', from: 'Jun', to: 'Aug', label: 'Summer campaign', tone: 'info' }],
zoom: true,
crosshair: true,
syncGroup: 'sales-months',
height: 280,
});
const orders = BarChart.create(hostIn(trend), {
label: 'Orders by month',
description: 'Hover or focus either chart: both show the same month.',
categories: MONTHS,
series: [{ id: 'orders', label: 'Orders', values: MONTHS.map((_, i) => 300 + Math.round(60 * Math.sin(i / 2)) + i * 12) }],
syncGroup: 'sales-months',
height: 200,
});
const grid = hostIn(sc.stage);
grid.className = 'sc-grid';
const quarter = section(sc, 'Revenue by quarter', ['bar-chart']);
const mix = section(sc, 'Product mix', ['pie-chart']);
grid.append(quarter, mix);
const bars = BarChart.create(hostIn(quarter), {
label: 'Revenue by quarter',
categories: ['Q1', 'Q2', 'Q3', 'Q4'],
series: [
{ id: 'licenses', label: 'Licenses', values: [310, 340, 365, 420] },
{ id: 'services', label: 'Services', values: [120, 135, 150, 160] },
],
valueFormat: { ...eur, maximumFractionDigits: 0 },
annotations: [{ type: 'line', axis: 'y', value: 400, label: 'Target', tone: 'success' }],
height: 260,
});
const pie = PieChart.create(hostIn(mix), {
label: 'Product mix',
slices: [
{ id: 'core', label: 'Core', value: 48 },
{ id: 'analytics', label: 'Analytics', value: 27 },
{ id: 'support', label: 'Support plans', value: 15 },
{ id: 'training', label: 'Training', value: 10 },
],
donut: true,
centerLabel: 'Share',
valueFormat: { style: 'percent', maximumFractionDigits: 0 },
height: 260,
});
const minis = section(sc, 'Sparklines', ['sparkline']);
const row = hostIn(minis);
row.className = 'sc-row';
const signups = Sparkline.create(hostIn(row), { label: 'Daily sign-ups', values: [12, 18, 15, 22, 30, 28, 35, 33, 41], variant: 'line', color: 1 });
const refunds = Sparkline.create(hostIn(row), { label: 'Daily refunds', values: [4, 3, 6, 2, 5, 3, 2, 1, 2], variant: 'bar', color: 2 });
sc.listen(line.host, ['aui-series-toggle', 'aui-zoom', 'aui-point-click'], 'line');
sc.listen(orders.host, ['aui-point-click'], 'orders');
sc.listen(bars.host, ['aui-series-toggle', 'aui-zoom', 'aui-point-click'], 'bars');
sc.listen(pie.host, ['aui-series-toggle', 'aui-point-click'], 'pie');
chartControls(sc, [line, orders, bars, pie], ['line-chart', 'bar-chart', 'pie-chart']);
chartLook(sc, [line, orders, bars, pie, signups, refunds]);
choice(
sc,
'Bars',
[
{ value: 'grouped', label: 'Grouped' },
{ value: 'stacked', label: 'Stacked' },
],
'grouped',
(layout) => {
bars.update({ layout });
},
['bar-chart'],
);
toggle(sc, 'Horizontal bars', false, (horizontal) => {
bars.update({ orientation: horizontal ? 'horizontal' : 'vertical' });
}, ['bar-chart']);
toggle(sc, 'Zoom the orders chart', false, (zoom) => {
orders.update({ zoom });
}, ['bar-chart']);
toggle(sc, 'Area under lines', false, (area) => {
line.update({ area });
}, ['line-chart']);
action(sc, 'Export trend (SVG)', () => {
void downloadChart(line, { format: 'svg', fileName: 'monthly-revenue.svg' });
}, ['line-chart']);
action(sc, 'Export mix (PNG)', () => {
void downloadChart(pie, { format: 'png', fileName: 'product-mix.png' });
}, ['pie-chart']);
import { BarChart } from '@absoluteui/components/bar-chart';
const host = document.createElement('div');
document.body.append(host);
BarChart.create(host, {
label: 'Support tickets by region',
categories: ['North America', 'Europe', 'Asia Pacific'],
series: [
{ id: 'open', label: 'Open', values: [34, 28, 19] },
{ id: 'closed', label: 'Closed', values: [120, 96, 88] },
],
valueAxis: { label: 'Tickets' },
valueLabels: true,
});

Horizontal stacked bars with negative values

Section titled “Horizontal stacked bars with negative values”
import { BarChart } from '@absoluteui/components/bar-chart';
const host = document.querySelector<HTMLElement>('#variance');
if (host) {
const chart = BarChart.create(host, {
label: 'Budget variance by department',
categories: ['Engineering', 'Marketing', 'Finance'],
series: [
{ id: 'capex', label: 'Capital', values: [40, 22, -8] },
{ id: 'opex', label: 'Operating', values: [25, -18, 12] },
],
orientation: 'horizontal',
layout: 'stacked',
valueFormat: { style: 'currency', currency: 'EUR', notation: 'compact' },
});
chart.setSeriesVisible('opex', false);
}
Terminal window
npm install @absoluteui/components @absoluteui/core @absoluteui/theme

Registry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.

import { BarChart } from '@absoluteui/components/bar-chart';
import '@absoluteui/components/bar-chart/style.css';
import { BarChart } from '@absoluteui/components/bar-chart';
import '@absoluteui/components/bar-chart/style.css';
const host = document.querySelector<HTMLElement>('#budget');
if (host) {
BarChart.create(host, {
label: 'Budget variance',
categories: ['Engineering', 'Marketing'],
series: [
{ id: 'capex', label: 'Capital', values: [40, -12] },
{ id: 'opex', label: 'Operating', values: [25, 18] },
],
orientation: 'horizontal',
layout: 'stacked',
});
}
More usage
import { BarChart } from '@absoluteui/components/bar-chart';
const host = document.createElement('div');
document.body.append(host);
BarChart.create(host, {
label: 'Orders by channel',
categories: ['Web', 'Store', 'Phone'],
series: [{ id: 'orders', label: 'Orders', values: [420, 310, 95] }],
valueLabels: true,
});

Using Angular? See Bar Chart for Angular.

BarChart.create(host: HTMLElement, options: BarChartOptions): BarChart

Global configuration key: barChart (see Configuration).

Option Type Default Description
label string Chart title: visible text and the accessible name of the plot (aria-labelledby). Required.
hideLabel boolean false Visually hide the title; it stays the accessible name.
description string Visible description below the title, also referenced by aria-describedby (text only).
summary string Replaces the generated accessible summary (aria-describedby).
valueFormat Intl.NumberFormatOptions Number format for values in tooltips, labels, the data table, the summary, and axis ticks (ticks use fixed fraction digits).
formatValue (value: number) => string Custom value text; overrides valueFormat everywhere except axis ticks.
hiddenSeries readonly string[] Ids of series (or slices) hidden initially; update() replaces the hidden set.
categories readonly string[] Category labels, one per bar group (text only). Required.
series readonly ChartSeries[] Series: { id, label, values: (number | null)[], color?: 1-8 }, one value per category; null, NaN, and infinities leave a gap. Required.
orientation 'vertical' | 'horizontal' "vertical" vertical: columns; horizontal: bars along the inline axis with category labels beside the plot.
layout 'grouped' | 'stacked' "grouped" grouped: side by side; stacked: summed per category (positives up from zero, negatives down).
categoryAxis { label?: string } Category axis title.
valueAxis { label?: string; min?: number; max?: number; tickCount?: number } Value axis title, fixed domain (bars are clipped to it), and approximate tick count (2-20). The automatic domain always includes zero.
zoom boolean false Zoom and pan over categories (vertical columns only; horizontal bar charts ignore it): a Zoom toolbar, +/= and - and 0 keys on a focused bar, arrow keys past the window edge pan, Ctrl/Cmd + wheel, drag to pan a zoomed chart, Shift + drag to select a range. Turning it off resets the window.
zoomRange ChartZoomRange | null Visible category index window { from, to }; null shows everything. Clamped to the data. Applied without an aui-zoom event; use with zoom: true.
annotations readonly ChartAnnotation[] Reference lines ({ type: ‘line’, axis: ‘x’ | ‘y’, value, label?, tone? }) and bands ({ type: ‘band’, axis, from, to, label?, tone? }); tone: ‘neutral’ | ‘info’ | ‘success’ | ‘warning’ | ‘danger’. Category-axis values are labels or indexes; value-axis values are numbers (x and y follow the orientation). Drawn under the marks (aria-hidden); listed in the accessible summary.
theme ChartTheme Look and feel: { palette?: string[] (1-8 CSS colors for slots 1-8); fontFamily?; fontSize? (8-32 px); textColor?; gridLines?: boolean; gridColor?; gridDash? (“4 2” or “none”); axisColor?; lineWidth? (0.5-12 px); markerSize? (1-20 px); cornerRadius?, barRadius?, cellRadius?, sliceRadius?, boxRadius? (0-50 px); swatchRadius? (0-8 px); tooltipRadius?, controlRadius? (0-50 px); lineJoin?: ‘round’ | ‘miter’ | ‘bevel’; areaOpacity? (0-1); gradient?: boolean; valueLabelColor?; tooltip?: { background?, color?, borderColor? }; legendPosition?: ‘top’ | ‘bottom’ | ‘start’ | ‘end’; animation?: boolean | { duration?: number (0-5000 ms) } }. Applied as –aui-chart-* custom properties and classes on the host through the CSSOM (CSP-safe); colors are validated with CSS.supports(‘color’). Animation is opt-in and never runs with prefers-reduced-motion: reduce or [data-aui-animation=‘none’].
renderTooltip (context: ChartTooltipContext) => Node | null Custom tooltip content as DOM nodes (never HTML strings). context: { title, rows: { label, value, seriesId }[], column, row, source: “pointer” | “focus” | “sync” }. Return null for the default tooltip. The tooltip stays aria-hidden; the focused mark keeps its accessible label.
syncGroup string Synchronized crosshair: charts with the same group show the crosshair, highlight, and tooltip at the same column (category or x index) when one of them is hovered or focused. Focus never moves between charts. Use charts that share their categories or x values.
legend 'auto' | 'show' | 'hide' "auto" auto: legend when there is more than one series (pie charts: always). Globally configurable.
dataTable 'toggle' | 'visible' | 'hidden' | 'none' "toggle" Data table fallback with the exact data: behind a Show data table button (built on first open), always visible, visually hidden (screen readers only), or none. Globally configurable.
tooltip boolean true Tooltip on pointer hover and keyboard focus. Globally configurable.
patterns boolean false Dash patterns and texture fills so series never differ by color alone. Off by default (plain colors); always on in forced colors. Turn it on when series are told apart by color alone (grouped or stacked series, multi-slice pies) and no labels carry the distinction (WCAG 1.4.1). Globally configurable.
height number 300 Plot height in CSS px (integer 120-2000); the width follows the container. Globally configurable.
valueLabels boolean false Print values at the bar ends (grouped) or inside segments that fit (stacked). Globally configurable.
locale string "en-US" Number, date, and message locale. Globally configurable. Inherited from common configuration.
direction 'ltr' | 'rtl' "ltr" rtl mirrors the category/x axis, the value axis side, and Left/Right arrow keys. Globally configurable. Inherited from common configuration.
Property Type Description
host HTMLElement The host element.
element SVGSVGElement The plot (svg role=“group”), named by the title and described by the summary.
summary string The generated (or custom) accessible summary.
hiddenSeries string[] Ids of hidden series (slices for Pie Chart).
zoomRange ChartZoomRange | null Current visible category window, or null when showing everything.
Method Description
update(options: Partial<BarChartOptions>): void Merge, validate, and re-render. Invalid options throw and keep the previous state. Keyboard focus stays on the same data point.
setSeriesVisible(id: string, visible: boolean): void Show or hide a series (slice) programmatically; emits no event.
destroy(): void Remove rendering, host classes, listeners, the resize observer, and the configuration subscription.
Event Detail Bubbles Cancelable Description
aui-series-toggle { id: string; visible: boolean; hidden: string[] } Yes No The user toggled a legend entry (pointer or keyboard). Not emitted for update() or setSeriesVisible().
aui-point-click BarChartPointClickDetail = ChartPointClickDetail: { seriesId: string | null; column: number; row: number; label: string; series: string; value: string; source: 'pointer' | 'keyboard' } Yes No A data mark was activated: pointer click or tap, or Enter / Space on the focused mark. label is the category, x value, or item; value is the formatted value text. Keyboard navigation is unchanged.
aui-zoom BarChartZoomDetail = ChartZoomDetail: { x: ChartZoomRange | null; y: null; reason: 'button' | 'keyboard' | 'wheel' | 'pan' | 'select' | 'reset' } Yes No The user changed the visible category window (toolbar, keys, Ctrl/Cmd + wheel, drag pan, Shift + drag selection). x is null when showing everything. Not emitted for the zoomRange option.

All rules live in the aui.components cascade layer, so application styles override them without specificity battles.

Class Purpose
aui-chart Host (shared chart chrome).
aui-bar-chart Host modifier for this chart type.
aui-chart--patterns patterns option on: dash patterns and textures shown.
aui-chart__header / __title / __title--hidden / __description Title and description.
aui-chart__legend / __legend-entry / __legend-item / __legend-item--hidden / __legend-label / __legend-detail Legend list and toggle buttons.
aui-chart__swatch aria-hidden legend and tooltip key (marker, dash, texture).
aui-chart__body / __svg / __layer Plot container (height from –aui-chart-height), SVG, and drawing layer.
aui-chart__grid / __gridline / __zero-line / __axis / __axis-line / __tick-label / __axis-title Axes (aria-hidden).
aui-chart__series--c1 ... --c8 Palette slot classes; set –aui-chart-color from color-chart-<n>.
aui-chart__dash--1 ... --4 / aui-chart__pattern / aui-chart__pattern-tile Dash patterns and texture overlays.
aui-chart__mark / __mark--active / __mark--hover Focusable data mark and its states.
aui-chart__value-label Printed values with a surface-colored halo.
aui-chart__tooltip / __tooltip-title / __tooltip-rows / __tooltip-row / __tooltip-label / __tooltip-value Tooltip (aria-hidden; the focused mark carries the same text).
aui-chart__empty Empty state text (No data, All series are hidden).
aui-chart__summary Hidden summary referenced by aria-describedby.
aui-chart__data / __data--hidden / __table-toggle / __table-scroll / __table / __cell--numeric Data table fallback.
aui-bar-chart--horizontal / --stacked Orientation and layout modifiers.
aui-bar-chart__bars / __series / __bar / __labels Bar groups, bar marks, and value labels.
aui-chart--legend-bottom / --legend-start / --legend-end theme.legendPosition (top is the default layout).
aui-chart--no-grid / --gradient / --animate / --entering theme.gridLines: false, theme.gradient, theme.animation (entering: the render that animates).
aui-chart__annotations / __annotation-line / __annotation-band / __annotation-label / __annotation--<tone> Annotations (aria-hidden), drawn under the marks.
aui-chart__gradient / __gradient-stop Gradient fills (theme.gradient).
aui-chart__tooltip--custom Tooltip content comes from renderTooltip.

Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.

--aui-border-width | --aui-color-border | --aui-color-border-strong | --aui-color-chart-1 | --aui-color-chart-2 | --aui-color-chart-3 | --aui-color-chart-4 | --aui-color-chart-5 | --aui-color-chart-6 | --aui-color-chart-7 | --aui-color-chart-8 | --aui-color-chart-axis | --aui-color-chart-grid | --aui-color-error-fg | --aui-color-focus-ring | --aui-color-hover | --aui-color-info-fg | --aui-color-link | --aui-color-success-fg | --aui-color-surface | --aui-color-surface-sunken | --aui-color-text | --aui-color-text-muted | --aui-color-warning-fg | --aui-duration-fast | --aui-easing-standard | --aui-focus-ring-offset | --aui-focus-ring-width | --aui-font-family-sans | --aui-font-size-md | --aui-font-size-sm | --aui-font-size-xs | --aui-font-weight-medium | --aui-font-weight-regular | --aui-font-weight-semibold | --aui-line-height-normal | --aui-line-height-tight | --aui-radius-md | --aui-radius-sm | --aui-shadow-md | --aui-space-1 | --aui-space-2 | --aui-space-3 | --aui-tooltip-max-width | --aui-touch-target-min

TypeScript definitions
interface BarChartConfig extends ChartBaseConfig { valueLabels: boolean }
interface BarChartOptions extends ChartCommonOptions, Partial<BarChartConfig> {
categories: readonly string[];
series: readonly ChartSeries[];
orientation?: 'vertical' | 'horizontal';
layout?: 'grouped' | 'stacked';
categoryAxis?: { label?: string };
valueAxis?: { label?: string; min?: number; max?: number; tickCount?: number };
}
interface BarChartSeriesToggleDetail { id: string; visible: boolean; hidden: string[] }

Pattern: SVG bar chart as a named, described group (role=“group” with aria-roledescription “column chart” or “bar chart”) of role=“img” bars with roving focus; data table fallback (native table, with a Total column when stacked).

Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.

Key Context Action
ArrowLeft / ArrowRight (vertical); ArrowUp / ArrowDown (horizontal) Mark focused Previous / next data point (category) in the same series; Left/Right are mirrored in RTL.
ArrowUp / ArrowDown (vertical); ArrowLeft / ArrowRight (horizontal) Mark focused, more than one visible series Same category in the previous / next visible series (nearest point when missing).
Home / End Mark focused First / last point of the series.
PageUp / PageDown Mark focused Ten points back / forward.
Escape Tooltip visible Hides the tooltip without moving focus (WCAG 1.4.13); it returns on the next move.
Tab / Shift+Tab Any Legend buttons, then one tab stop for the plot (the active mark), then the Show data table button and table region.
Enter / Space Legend button Shows or hides the series (native button).
Element Role
svg.aui-chart__svg group with aria-roledescription (localized chart type), named by the title
data marks (points, bars, slices) img with an aria-label: category/x, series, formatted value
legend list (ul) named “Legend”; entries are toggle buttons (aria-pressed)
data table table (native) with caption, column headers, and row headers; wide tables scroll in a focusable region
axes, lines, textures, value labels, tooltip aria-hidden (decorative duplicates of the accessible data)
Attribute Element Value
aria-labelledby svg id of the visible (or visually hidden) title
aria-describedby svg description id (when provided) and the generated summary id
aria-roledescription svg Localized chart type, for example “line chart”
aria-label each mark Localized “{x}, {series}: {value}” (pie: “{label}: {value} ({percent})”)
tabindex active mark 0 on exactly one mark (roving); other marks have none
aria-pressed legend button true while the series is visible
aria-expanded / aria-controls Show data table button Table open state and the table region id

Roving focus: one mark is in the tab sequence and remembers the last visited data point, also across re-renders (resize, update). Toggling a legend entry keeps focus on its button; toggling the table keeps focus on the table button.

Criterion Level Note
1.1.1 Non-text Content A
1.3.1 Info and Relationships A
1.4.1 Use of Color A
1.4.3 Contrast (Minimum) AA
1.4.10 Reflow AA
1.4.11 Non-text Contrast AA
1.4.13 Content on Hover or Focus AA
2.1.1 Keyboard A
2.4.3 Focus Order A
2.4.7 Focus Visible AA
4.1.2 Name, Role, Value A

Automated test results: Accessibility and compliance.

  • The generated summary lists the chart type, series and point counts, axis ranges, per-series minimum and maximum with their positions, the overall trend, missing values, and hidden series.
  • Meaning never depends on color alone: marker shapes, dash patterns, and textures (patterns option), plus legend keys that repeat them.
  • Forced colors: series use CanvasText and keep shapes, dashes, and textures; focus uses Highlight.
  • No animation: nothing moves on render; hover and focus emphasis transitions are removed under prefers-reduced-motion and animation: none.
  • Bars are separated by a surface-colored stroke, so adjacent (stacked) segments never depend on the contrast between two series colors.
  • Hovering a category shows every visible series and, when stacked, the total.
  • Manual screen-reader verification (NVDA, JAWS, VoiceOver, TalkBack) is pending.
  • aria-roledescription support varies; screen readers without it announce “group”.
Import cost Minified gzip brotli CSS brotli
@absoluteui/components/bar-chart 90.0 kB 31.3 kB 27.5 kB 2.4 kB

Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.

Budget (enforced in CI) Limit
BarChart.create, 50 categories x 4 series (grouped and stacked), including the first render < 30 ms in headless Chromium (e2e performance test, median of 5)

Tested scale: Up to about 200 bars at once (each bar is one focusable node plus one texture overlay). For hundreds of categories, aggregate first or use a Data Table.

Budget: create with 50 categories x 4 series under 30 ms including the first render (e2e performance test, median of 5).

Measured run times: Performance.

States

default, empty, all series hidden, series hidden, bar focused (tooltip), category hovered, table open; orientation vertical | horizontal; layout grouped | stacked.

State transitions
From Trigger To
any legend button series hidden or shown; aui-series-toggle; domain rescales
plot not focused Tab active bar focused, tooltip shown
bar focused arrow keys, Home, End, PageUp, PageDown another bar focused
tooltip visible Escape tooltip hidden
table closed Show data table table shown
Accessibility notes
  • Bars are separated by a color-surface stroke, so stacked segments never depend on contrast between two series colors.
  • Textures are the non-color cue for series; keep patterns on for grouped or stacked series.
  • Forced colors: bars use CanvasText with Canvas textures; focus and hover use Highlight.
  • No animation. Manual screen-reader verification is pending.
Responsive behavior

Width follows the container; category labels are truncated or thinned; horizontal charts reserve at most 40% of the width for labels. Reflows at 320 CSS px.

Right-to-left

Vertical charts mirror the category axis; horizontal bars grow leftward from a right-hand zero line; axis labels move to the right; ArrowLeft/ArrowRight swap.

Theming

Series use color-chart-1..8 (3:1 against surface, background, and sunken surfaces in all themes). Gridlines color-chart-grid, axes color-chart-axis, labels color-text-muted.

Global configuration
configureAbsoluteUI({ components: { barChart: { valueLabels: true, legend: 'show' } } });
Component configuration

Instance options override global and theme defaults. All options are dynamic.

Timezones

Not applicable (categories are text).

Security

All text uses textContent; SVG uses createElementNS; colors are classes; texture fills reference per-instance pattern ids through the fill attribute. No innerHTML or style attributes.

Data handling

No persistence, network access, or telemetry.

Supported data scale

Up to about 200 bars (each is one focusable node plus one texture overlay). Aggregate larger data first or use a Data Table.

Edge cases
  • Empty categories or series: “No data”; every series hidden: “All series are hidden”.
  • Missing values: no bar, “No value” in the table; stacked totals treat them as 0.
  • Negative values: grouped bars grow below zero; stacked positives and negatives stack separately.
  • A fixed valueAxis domain clips bars at its edges.
  • Long category labels are truncated with an ellipsis; the full text stays in bar labels, tooltip, and table.
Errors
Code Category Cause
BAR_CHART_OPTIONS configuration Missing label; categories not strings; duplicate series ids; values length differs from categories; invalid orientation, layout, or axis options.
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION configuration Invalid or unknown configuration.

A failed construction leaves the host untouched.

Known limitations
  • One value per category per series.
  • Stacked value labels are printed only inside segments that fit them.
  • Manual screen-reader verification is pending.
  • Animation is opt-in (theme.animation) and replays after each data or option change; it never runs with prefers-reduced-motion: reduce or [data-aui-animation='none'].
  • syncGroup matches charts by column index (category or x index); use it for charts that share their categories or x values.
  • Zoom applies to vertical (column) charts only; horizontal bar charts ignore zoom.
Unsupported scenarios
  • 100% stacked, waterfall, bullet, and combo charts.
  • Logarithmic or broken axes; zoom, selection, export.
  • HTML in labels.