Skip to content

Bar Chart for Angular

AngularCharts

Accessible SVG bar and column chart for comparing values across categories: vertical or horizontal, grouped or stacked, with negative values, gaps, optional value labels, a toggleable legend, keyboard-reachable bars with tooltips, a generated summary, and a data table fallback.

  • 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.

Behavior, design tokens, and limitations are described on the Bar Chart page; this page covers the Angular API.

import { Component } from '@angular/core';
import { AuiBarChart } from '@absoluteui/angular/bar-chart';
import type { ChartSeries } from '@absoluteui/components/bar-chart';
@Component({
selector: 'app-orders',
imports: [AuiBarChart],
template: `<aui-bar-chart label="Orders by channel" [categories]="channels" [series]="series" layout="stacked"></aui-bar-chart>`,
})
export class OrdersComponent {
readonly channels = ['Web', 'Store'];
readonly series: ChartSeries[] = [{ id: 'orders', label: 'Orders', values: [420, 310] }];
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiBarChart } from '@absoluteui/angular/bar-chart';

Defaults for every instance: provideAbsoluteUIConfig({ components: { barChart: { ... } } }) (see Configuration).

Class AuiBarChart; template reference #ref="auiBarChart".

Server rendering: Renders on the server; the browser re-creates it after hydration.

Input Type Default Description
label string Required. Chart title: visible text and the accessible name of the plot (aria-labelledby).
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 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.
categories readonly string[] Required. Category labels, one per bar group (text only).
series readonly ChartSeries[] Required. Series: { id, label, values: (number | null)[], color?: 1-8 }, one value per category; null, NaN, and infinities leave a gap.
orientation BarChartOrientation 'vertical' vertical: columns; horizontal: bars along the inline axis with category labels beside the plot.
layout BarChartLayout 'grouped' grouped: side by side; stacked: summed per category (positives up from zero, negatives down).
categoryAxis BarChartCategoryAxis Category axis title.
valueAxis BarChartValueAxis 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.
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 ChartTooltipRenderer 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 ChartLegendMode 'auto' auto: legend when there is more than one series (pie charts: always).
dataTable ChartTableMode '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.
tooltip boolean true Tooltip on pointer hover and keyboard focus.
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).
height number '300' Plot height in CSS px (integer 120-2000); the width follows the container.
valueLabels boolean false Print values at the bar ends (grouped) or inside segments that fit (stacked).
locale string 'en-US' Number, date, and message locale.
direction Direction 'ltr' rtl mirrors the category/x axis, the value axis side, and Left/Right arrow keys.
Model Type Change output Description
[(hiddenSeries)] readonly string[] (hiddenSeriesChange) Ids of series (or slices) hidden initially; update() replaces the hidden set.
[(zoomRange)] ChartZoomRange | null (zoomRangeChange) Visible category index window { from, to }; null shows everything. Clamped to the data. Applied without an aui-zoom event; use with zoom: true.
Output Payload Description
(seriesToggled) BarChartSeriesToggleDetail The user toggled a legend entry (pointer or keyboard). Not emitted for update() or setSeriesVisible(). Re-emits aui-series-toggle.
(pointClicked) ChartPointClickDetail 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. Re-emits aui-point-click.
(zoomed) ChartZoomDetail 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. Re-emits aui-zoom.

Call them through a viewChild query or a template reference.

Method Description
setSeriesVisible(id: string, visible: boolean): void Show or hide a series (slice) programmatically; emits no event.

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).

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Bar Chart: Accessibility and performance.