Chart

organisms

Chart wrapper for line, bar, donut, sparkline. Recharts/Victory integration point.

ARIA Role: img

Demo

Demo for Chart (organisms)

Chart wrapper for line, bar, donut, sparkline. Recharts/Victory integration point.

Props

PropTypeRequiredDefaultDescription
type'line' | 'bar' | 'donut' | 'sparkline'YesChart type
dataChartData[]YesChart data points
titlestringNoChart title
heightnumberNo300Chart height in pixels
colorsstring[]NoChart colors

TypeScript Interface

interface ChartProps {
  type: 'line' | 'bar' | 'donut' | 'sparkline';
  data: ChartData[];
  title?: string;
  height?: number;
  colors?: string[];
}

Assertions (NASA Rule 5)

  • [aria]Container must have role='img' with aria-label or aria-labelledby(WCAG 1.1.1)
  • [aria]Provide data table alternative (visually-hidden but accessible)(WCAG 1.1.1)
  • [validation]Color is not the only visual encoding (use patterns/labels too)(WCAG 1.4.1)

Usage

Import

import { Chart } from '@epasslive/design-system'

Basic

<Chart />

With Variants

<Chart variant="primary" size="md" />