All components (283)
Combo chart
Data · ComboChart
What it is and when to use it
Bars and lines in the same drawing, each series on its own axis if needed: invoiced in bars and margin in a line. It is the chart of a financial dashboard, and it crosses two measures of different scale without making two charts.
The drawing is the decoration and the table is the data: underneath goes a real table (one row per category, one column per series), hidden from view unless tableVisible.
When to use it
- A quantity and a percentage over the same period: sales and margin, orders and return rate.
- A measure and its reference: actuals in bars and forecast in a line.
- Each series states its
type(bar, by default, orline) and itsaxis(start, by default, orend). The right axis only appears if some series asks for it. formatwrites the left axis andformatEndthe right one.min,max,minEndandmaxEndfix each scale.loadinganderrorsay so in the place of the drawing, with the same height, so the page does not jump when the data arrives.
renderTooltippaints the tooltip of each category your way, with the value of each series already written with the format of its axis.animated(the default) animates the entrance and the change of data.
When not to
- Series of the same unit that just evolve:
LineChart. - The total and what it is made of:
StackedBarChart. - Two measures without a common period, to see whether they go together:
ScatterChart.
Keyboard: Tab takes you to the drawing (a single tab stop) and the arrows move from point to point; up and down change series, Home and End go to the first and last, and Escape leaves. A spoken notice says each point. With onPointPress, each value in the tooltip is a button.
Accessibility: the drawing is an image (role="img") with a written summary of each series, in the format of its axis. Series are also told apart without colour: the line's stroke, the point's shape and the bar's pattern. In forced contrast they take system colours.
Fine look: the --amset-series-* CSS variables of the other series charts: -axis, -bar, -cap, -footer, -height, -label, -stroke.
What it looks like
- Invoiced
- Margin
| Month | Invoiced | Margin |
|---|---|---|
| Jan | 4200 € | 18 % |
| Feb | 3900 € | 16 % |
| Tue | 5100 € | 21 % |
| Apr | 6400 € | 24 % |
| May | 6100 € | 22 % |
| Jun | 7300 € | 27 % |
| Jul | 6900 € | 26 % |
| Aug | 5200 € | |
| Sep | 7800 € | 29 % |
<ComboChart
label="Invoiced and margin in 2026"
categories={meses}
series={[
{ key: "facturado", label: "Invoiced", type: "bar", values: facturado },
{ key: "margen", label: "Margin", type: "line", axis: "end", tone: "warning", values: margen },
]}
format={enEuros}
formatEnd={enPorcentaje}
categoryName="Month"
/>Props
Import it with import { ComboChart } from '@amset/ui'. Required props are marked.
| Prop | Type | What it does |
|---|---|---|
categoriesrequired | readonly string[] | What goes on the bottom axis: the months, the days. One per value of each series. |
labelrequired | string | What is being measured. Required: a chart without a title does not inform. |
seriesrequired | readonly ComboChartSeries[] | The series, each with its `type` (`bar` or `line`) and its `axis` (`start` or `end`). |
animated | boolean | Animates the drawing on entry and when the data change, as in the rest of the series charts. `true` by default. |
categoryName | string | What the first column of the table is called. By default, "Period". |
className | string | Merged with the library classes; it does not replace them. |
error | ReactNode | The data has not arrived: it says so in the place of the drawing, with what is passed here. |
format | (value: number) => string | How a value of the left axis is written. |
formatEnd | (value: number) => string | How a value of the right axis is written. Without this, the same as the left one. |
height | number | Height of the drawing in pixels. By default, that of the size. |
hiddenSeries | readonly string[] | The keys of the hidden series, when the chart's user keeps them. Without it, the chart keeps them itself. |
legend | boolean | The legend with the name of each series. By default, only if there is more than one. |
loading | boolean | The data is on its way: a notice appears in the place of the drawing, and the page does not jump when it arrives. |
max | number | — |
maxEnd | number | — |
min | number | Minimum and maximum of the left axis, by hand. |
minEnd | number | Minimum and maximum of the right axis, by hand. |
onHiddenSeriesChange | (hidden: readonly string[]) => void | Called with the hidden keys after a legend entry is pressed. |
onPointPress | (point: ChartPoint) => void | Makes every value pressable (in the tooltip of its category, also by keyboard and touch) and hands over the pressed point. |
referenceBands | readonly ChartReferenceBand[] | Horizontal reference bands, measured on the left axis. |
referenceLines | readonly ChartReferenceLine[] | Horizontal reference lines, measured on the left axis. |
renderTooltip | (info: ChartTooltipInfo) => ReactNode | Paints the tooltip of each category instead of the built-in one: it receives its rows already written with the format of each axis. |
size | "sm" | "md" | "lg" | — |
tableVisible | boolean | Also shows the table. For the screen reader it is always there. |
toggleSeries | boolean | The legend stops being a label and each entry becomes a button that hides or brings back its series. |
It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.
In the test bench
Every state and variant, to try one at a time, on its page at storybook.amsetui.com:
