GroupedBar
Barras lado a lado, una por serie, en cada periodo: compara las series periodo a periodo. Es BarChart con dos o más series.
import { BarChart } from '@sypnia/ui/react'
En esta página
Registros por plan
Sign-ups by plan
Per month
- Free
- Pro
Ver como tabla
| Free | Pro | |
|---|---|---|
| Jul | 120 | 30 |
| Aug | 150 | 42 |
| Sep | 140 | 38 |
| Oct | 190 | 55 |
| Nov | 210 | 61 |
Código
import { BarChart } from '@sypnia/ui/react';
// Bars side by side to compare series in each period.
export default function Compare() {
return <BarChart title="Sign-ups by plan" subtitle="Per month" x={['Jul', 'Aug', 'Sep', 'Oct', 'Nov']}
series={[{ id: 'free', label: 'Free', data: [120, 150, 140, 190, 210] }, { id: 'pro', label: 'Pro', data: [30, 42, 38, 55, 61] }]} />;
} Cuándo usarlo
Úsalo cuando
- Comparar unas pocas series en cada periodo.
No lo uses cuando
- Más de tres series: los grupos quedan delgados.
- Partes de un total: usa StackedBar.
Para todos
- Pasa el puntero o enfoca una barra para leer cada serie de ese periodo; la tabla las tiene todas.
Props
| BarChart | Tipo | Por defecto |
|---|---|---|
seriesobligatorio | Series[] | |
titleobligatorio | ReactNode | |
xobligatorioThe positions along the horizontal axis: dates, hours, names. | string[] | |
empty | ReactNode | |
error | ReactNode | |
formatValueHow a value is written in ticks, tooltip and table. Defaults to a compact number in the person's language. | ((v: number) => string) | |
height | number | |
loading | boolean | |
stackedSeries on top of each other (parts of a total) instead of side by side. | boolean | false |
subtitle | ReactNode | |
xLabelThe header of the first column of the table view: what `x` is. | string |