Skip to content
GitHub (opens in a new tab)

Combo

Bars and a line on one chart over the same categories, like revenue as bars with growth rate as a line. One shared value axis, or a second axis on the right for the line.

stableOrganismcontracts/combochart.json

Preview

ComboChart

Bars and a line on one chart over the same categories, like revenue with its growth rate. One shared axis, or a second axis on the right when the line has its own unit.

Master

Revenue by month as bars, growth as a line on a percent axis.

Revenue and growth

2026, by month

Usage

axis="dual" gives the line its own scale on the right, with ticks on the same gridlines. Hover or Tab to a column to read every value at once; arrow keys move column by column. Bars alone stay BarChart, lines alone stay LineChart.

Do's

  • An amount and a rate or average over the same periods, like revenue with month-over-month growth
  • Volumes with a running target or moving average drawn across them
  • Two measures people read together per column, where two separate charts would make them line up by eye
  • Gains and losses per period with the net as a line — stack stacked, losses as negative values
  • Net change per period that can go below zero, with the running total as the line on axis dual — one bar series, stack none

Don'ts

  • Only amounts compared across categories — use BarChart
  • Only a trend over time, one or several series — use LineChart
  • Part of a whole — use PieChart
  • A short ranking by one measure — use BarList
<ComboChart
  title="Revenue and growth"
  description="2026, by month"
  axis="dual"
  data={[
    { label: "Jan", revenue: 42000 }, // no earlier month, so no growth
    { label: "Feb", revenue: 45500, growth: 8.3 },
    { label: "Mar", revenue: 44100, growth: -3.1 },
  ]}
  bars={[{ key: "revenue", label: "Revenue" }]}
  line={{ key: "growth", label: "Growth, month over month" }}
  valueFormatter={{ bars: euro, line: (value) => `${value}%` }}
/>

When to use

  • An amount and a rate or average over the same periods, like revenue with month-over-month growth
  • Volumes with a running target or moving average drawn across them
  • Two measures people read together per column, where two separate charts would make them line up by eye
  • Gains and losses per period with the net as a line — stack stacked, losses as negative values
  • Net change per period that can go below zero, with the running total as the line on axis dual — one bar series, stack none

When not to use

  • Only amounts compared across categories — use BarChart
  • Only a trend over time, one or several series — use LineChart
  • Part of a whole — use PieChart
  • A short ranking by one measure — use BarList

What an agent reads

import { Combo } from "agentic-ds-kit";
must
  • Title on the figure when provided, and the plot is a role=group named by it
  • Each column is one focus stop in order; Tab and the arrow keys move column by column, and each column names its label and every bar and line value
  • The tooltip shows on focus as well as on hover, with every series for that column
  • The legend names each bar series and the line, with the line drawn as a line
  • The Table toggle swaps the chart for a plain table with every value
  • error replaces the plot with a role=alert row; Retry is a real Button
  • tooltipNote is read with the tooltip (role=status)
defaults
  • axis shared
  • stack none
  • height 240
  • isLoading false
  • emptyLabel No data for this range
stops if
  • Do not use it for bars alone — use BarChart
  • Do not use it for lines alone — use LineChart
  • Do not stack a BarChart and a LineChart on top of each other to fake one — use ComboChart
  • Do not draw more than one line; a second trend belongs in LineChart
  • Do not use axis dual for values in the same unit; it makes the two scales look comparable when they are not
  • Do not use status colours for the series; a series that means good or bad says so in its label
  • Do not use raw hex or primitive --color-* ramps
  • Do not stack values that do not add up, like rates; use stack none
  • Do not pass losses as positive values with a status colour; make them negative so they pile below zero
  • Do not wrap a chart in a Card only to get a header button — pass actions
  • Do not round bar corners or line ends; bars and line ends are square

From contracts/combochart.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
dataarrayYes—One row per category, in the order shown.
barsarrayYes—One to four bar series. They take --chart-1, --chart-2, --chart-4 and --chart-5 in order, so the line colour stays apart.
lineobjectYes—One line series, drawn smooth in --chart-3 with no area fill and square ends.
axisshared | dualNosharedshared puts bars and line on one left axis, for the same unit. dual gives the line its own axis on the right, for a different unit like a percent; its ticks line up with the left gridlines. With dual, the right axis fits the line's own range and does not force zero, so a running total like MRR keeps its shape.
stacknone | stackedNononestacked draws one bar per column: positive values pile up from zero and negative values pile down, in series order, with a hairline (surface.card) between segments. Use it for movements that add up, like gains and losses in a period, with the line as the net. With none, a single bar series still goes below zero for negative values, in one colour: use it for a daily net change with the running total as the line.
valueFormatterobjectNo—Both default to the chart format: 1,240, 12.4k, 1.2M. With axis shared, the left axis uses the bars formatter.
titlestringNo—Chart heading on the frame, like the other charts. Also names the plot for screen readers.
descriptionstringNo——
heightnumberNo240—
isLoadingbooleanNofalseDims the plot and sets aria-busy while new data loads.
emptyLabelstringNoNo data for this range—
errorstringNo—When set, the plot is replaced by the kit's "Couldn't load" row (role=alert) with this message. Say what failed and that data is safe, like "Stripe didn't answer in time."
onRetryfunctionNo—Shows an outline Retry Button on the error row.
tooltipNotefunctionNo—(index) => string | undefined. One sentence under the tooltip rows for that column, like "The largest one-day drop in this period." Read with the tooltip; keep it short and plain.
actionsslotNo—Kit Buttons in the chart header, before the Table toggle, like an icon-only Ask. ghost sm reads quietest. Setting it draws the frame even with no title.
  • Component
    →

    Bar

    Compare magnitudes across categories with vertical or horizontal bars.

  • Component
    →

    Line

    Change and progress over ordered samples as a line or area chart.

  • Component
    →

    Pie

    Part-to-whole share for a handful of segments, as a donut or solid pie.

  • Component
    →

    BarList

    A ranked list: each row shows a label and its value, with a quiet horizontal bar behind the label sized against the largest value or the total.