Line Chart for Angular
Introduction
Section titled “Introduction”Accessible SVG line and area chart for trends over a shared x axis (categories, numbers, or instants in the configured timezone) with one or more series, gaps for missing values, a toggleable legend, keyboard-reachable points with tooltips, optional zoom and pan along x and a crosshair, a generated summary, and a data table fallback.
- Trends over timeSeries over categories, numbers, or dates, with gaps for missing values and an optional area fill.
- Zoom and crosshairZoom and pan along the x axis with a toolbar, keys, wheel, or drag, plus an optional crosshair.
- Keyboard pointsOne tab stop; arrow keys move between points and show the tooltip on focus.
- Data table fallbackA generated summary and a table with the exact values for screen readers.
- Not color aloneSeries differ by color, marker shape, and dash pattern.
Behavior, design tokens, and limitations are described on the Line Chart page; this page covers the Angular API.
Live example
Section titled “Live example”import { Component } from '@angular/core';import { AuiLineChart } from '@absoluteui/angular/line-chart';import type { ChartSeries } from '@absoluteui/components/line-chart';
@Component({ selector: 'app-revenue', imports: [AuiLineChart], template: `<aui-line-chart label="Revenue" [x]="months" [series]="series" (seriesToggled)="hidden = $event.hidden"></aui-line-chart>`,})export class RevenueComponent { readonly months = ['Jan', 'Feb', 'Mar']; readonly series: ChartSeries[] = [{ id: 'rev', label: 'Revenue', values: [120, 135, 150] }]; hidden: string[] = [];}Install and start
Section titled “Install and start”npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/themeSetup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.
import { AuiLineChart } from '@absoluteui/angular/line-chart';Defaults for every instance: provideAbsoluteUIConfig({ components: { lineChart: { ... } } }) (see Configuration).
API reference
Section titled “API reference”<aui-line-chart>
Section titled “<aui-line-chart>”Class AuiLineChart; template reference #ref="auiLineChart".
Server rendering: Renders on the server; the browser re-creates it after hydration.
Inputs
Section titled “Inputs”| 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. | |
x |
readonly LineChartXValue[] |
Required. Shared x values, one per point: strings (category axis), numbers (linear axis), or instants (time axis). Numbers and instants must be ascending. | |
series |
readonly ChartSeries[] |
Required. Series: { id, label, values: (number | null)[], color?: 1-8 }. values has exactly one entry per x value; null, NaN, and infinities are gaps. | |
area |
boolean |
false |
Fill the area between each line and the zero baseline (includes zero in the domain). |
xType |
LineChartXType |
Axis type. Default: inferred from the first x value. | |
xAxis |
LineChartAxis |
X axis title and approximate tick count (2-20). | |
yAxis |
LineChartYAxis |
Y axis title, tick count, fixed domain, and zero inclusion (default true with area). | |
formatX |
(value: LineChartXValue, index: number) => string |
Custom x text for tooltips, labels, the table, and the summary. | |
timeFormat |
Omit<DateTimeFormatOptions, "timeZone"> |
Date format of time x values. Default: chosen from the data resolution (year, month, day, minute, second). | |
zoom |
boolean |
false |
Zoom and pan along x: a Zoom toolbar (Zoom in, Zoom out, Reset zoom), +/= and - and 0 keys on a focused point, 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’. x values are category labels or indexes, numbers, or epoch ms (time axes); y values are numbers. 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. |
markers |
LineChartMarkers |
'auto' |
Point markers: auto when points are at least 12 px apart; focus shows only the hovered or focused point. Isolated points always show a marker. |
crosshair |
boolean |
false |
Vertical crosshair line (aria-hidden) at the hovered or focused x value. |
locale |
string |
'en-US' |
Number, date, and message locale. |
timezone |
string |
'UTC' |
IANA timezone for time axes, tooltips, labels, and the table. |
direction |
Direction |
'ltr' |
rtl mirrors the category/x axis, the value axis side, and Left/Right arrow keys. |
Two-way bindings
Section titled “Two-way bindings”| 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 x window { from, to } in data units (category index, number, or epoch ms for time axes); null shows everything. Clamped to the data and to at least two points. Applied without an aui-zoom event; use with zoom: true (the toolbar and keys need it). |
Outputs
Section titled “Outputs”| Output | Payload | Description |
|---|---|---|
(seriesToggled) |
LineChartSeriesToggleDetail |
The user toggled a legend entry (pointer or keyboard). Not emitted for update() or setSeriesVisible(). Re-emits aui-series-toggle. |
(zoomed) |
ChartZoomDetail |
The user changed the visible window (toolbar, keys, Ctrl/Cmd + wheel, drag pan, Shift + drag selection). x is null when showing everything. Not emitted for the zoomRange option or when the window does not change. Re-emits aui-zoom. |
(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. |
Methods
Section titled “Methods”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. |
Accessibility and performance
Section titled “Accessibility and performance”Pattern: SVG chart as a named, described group (role=“group” with aria-roledescription) of role=“img” data points with roving focus; data table fallback (native table). Follows the WAI Complex Images tutorial (short name plus long description) and the roving tabindex technique of WAI-ARIA APG.
The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Line Chart: Accessibility and performance.
(c) 2026 Kasadara Technology Solutions Pvt Ltd. AbsoluteUI is free to use under the AbsoluteUI Free Use License; it is not open source.