Skip to content
Alea0.1
Pro
  1. Alea
  2. Components
  3. Charts
  4. ComboChart

ChartsAlea Pro

ComboChart

Bars and lines on the same axes: amounts with a trend or a rate, like revenue and orders.

import { ComboChart } from '@alea/pro';

Examples

Bars and a line

Amounts as bars, the rate as a line on the same axis. Hover a legend item to bring its series forward.

Revenue and orders

Orders grew every month; revenue dipped in March.

  • Revenue ($k)
  • Orders
020406080JanFebMarAprMayJun

Tokens

The design tokens this component reads, with their value in the current theme. Override any of them to restyle it.

Color

  • --alea-border…
  • --alea-focus…
  • --alea-text-muted…

Type

  • --alea-font-family-body…

Motion

  • --alea-motion-duration-fast…
  • --alea-motion-duration-slower…
  • --alea-motion-ease-out…
  • --alea-motion-spring…

Props

ComboChart props

Bars and lines on the same axes: amounts with a trend or a target (revenue and margin, visits and conversion).

PropTypeDefaultDescription
barsrequiredSeries[]-Series drawn as bars.
datarequiredChartRow[]-
linesrequiredSeries[]-Series drawn as lines on top (same axis).
xrequiredstring-The key for the x axis.
classNamestring-Extra class names for the root element.
descriptionReactNode-One sentence on what the data shows; read before the chart.
heightnumber280Plot height in px. Default 280.
isLoadingboolean-Shows a shimmering placeholder while data loads.
showTablebooleantrueShows the table toggle. Default true.
titleReactNode-The title shown above it and read by screen readers.
valueFormat((v: number) => string)-Formats values (axis, tooltip, table).

Specs

Generated from the source: the variants in the types, the states and tokens in the CSS, and the motion patterns that apply. The grids render the real component in both themes; the numbers are measured from the page.

States
Keyboard focus
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-chart-svgwrap.alea-chart-svg.alea-chart-grid.alea-chart-axis.alea-chart-bargroup.alea-chart-bar.alea-chart-line
Data attributes
data-dim

Accessibility

  • The chart is a figure named by its title and described by its description; the picture has a text summary.
  • Tab to the chart, then arrow keys move through the data and each value is announced; Escape leaves.
  • The table toggle shows the same data as a real table for everyone who can't use the picture.

Keyboard

KeyDoes
TabFocuses the chart
Left or Right arrowPrevious or next value
Home or EndFirst or last value
EscapeClears the selection

Do and don't

Do

  • Put the amount in bars and the rate or trend in the line.
  • Label both axes when they measure different things.

Don't

  • Don't use two axes to suggest a relation the data doesn't show.
  • Don't put more than two series of each kind.
Tested with axe, keyboard and screen reader roles