AreaChart
Una línea con un velo suave debajo, para una cantidad que se acumula: almacenamiento usado, registros totales. Dos o más series llevan leyenda.
import { AreaChart } from '@sypnia/ui/react'
En esta página
Almacenamiento usado
Storage used
Last 8 weeks
- Database
- Files
Ver como tabla
| Week | Database | Files |
|---|---|---|
| W1 | 114 MB | 38 MB |
| W2 | 172 MB | 57 MB |
| W3 | 248 MB | 86 MB |
| W4 | 296 MB | 143 MB |
| W5 | 401 MB | 153 MB |
| W6 | 448 MB | 210 MB |
| W7 | 534 MB | 248 MB |
| W8 | 582 MB | 286 MB |
Código
import { AreaChart, useSypnia } from '@sypnia/ui/react';
// A quantity that accumulates: the wash under the line says «this much, so far».
export default function Storage() {
const { format } = useSypnia();
return <AreaChart title="Storage used" subtitle="Last 8 weeks" xLabel="Week" x={['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8']}
formatValue={(v) => format.bytes(v * 1e6)} series={[{ id: 'db', label: 'Database', data: [120, 180, 260, 310, 420, 470, 560, 610] }, { id: 'files', label: 'Files', data: [40, 60, 90, 150, 160, 220, 260, 300] }]} />;
} Cuándo usarlo
Úsalo cuando
- Totales que crecen con el tiempo.
No lo uses cuando
- Tasas y porcentajes: usa LineChart.
- Más de tres series: los velos se tapan entre sí.
Para todos
- Pasa el puntero o enfoca para leer todas las series en un punto; la tabla tiene todos los números.
Props
| AreaChart | 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 | |
subtitle | ReactNode | |
xLabelThe header of the first column of the table view: what `x` is. | string |