All components

Chart

Compare values against a known scale.

Examples

Compare values against a known scale

Requests resolved out of 10

Monday

Tuesday

React code
import { Chart, ChartBars, ChartBar } from "@accelerate/react/components";

export function Example() {
  return (
    <>
      <Chart>
        <figcaption>Requests resolved out of 10</figcaption>
        <ChartBars>
          <p>Monday <ChartBar min={0} max={10} value={6} aria-label="Monday: 6 out of 10"></ChartBar></p>
          <p>Tuesday <ChartBar min={0} max={10} value={8} aria-label="Tuesday: 8 out of 10"></ChartBar></p>
        </ChartBars>
      </Chart>
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import { AccChart, AccChartBars, AccChartBar } from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccChart,
    AccChartBars,
    AccChartBar,
  ],
  template: `
    <figure accChart>
      <figcaption>Requests resolved out of 10</figcaption>
      <div accChartBars>
        <p>Monday <meter accChartBar min="0" max="10" value="6" aria-label="Monday: 6 out of 10"></meter></p>
        <p>Tuesday <meter accChartBar min="0" max="10" value="8" aria-label="Tuesday: 8 out of 10"></meter></p>
      </div>
    </figure>
  `,
})
export class Example {}

Installation

Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.

React
@accelerate/ui@0.4.0 and @accelerate/react@0.4.0
Angular
@accelerate/ui@0.4.0 and @accelerate/angular@0.2.0

Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.

Usage

Compose a figcaption and ChartPlot (Angular <acc-chart-plot>) for bar, line or area charts with a legend and an accessible data table. Use ChartBars and labeled ChartBar meters for simple comparisons, or provide a custom chart renderer.

Import the React component Chart from @accelerate/react/components. For Angular, add AccChart to the standalone component’s imports and use <figure accChart>.

Examples use these React parts: Chart, ChartBars, ChartBar. The Angular examples show the corresponding directives and template hosts.

API reference

ChartBar
A meter for values on a defined scale.
ChartPlot
Use for bar, line, or area series with a legend and accessible data table.