HorizontalBar
Un valor por categoría, con los nombres a la izquierda donde caben los nombres largos: los endpoints más lentos, el almacenamiento por tabla. Ordenado de mayor a menor.
import { HorizontalBar, RowsChartSkeleton } from '@sypnia/ui/react'
Endpoints más lentos, y el skeleton
Slowest endpoints
Time to answer, 95th percentile
Ver como tabla
| Endpoint | |
|---|---|
| GET /orders?include=items | 840 ms |
| POST /checkout | 620 ms |
| GET /products/search | 410 ms |
| POST /login | 180 ms |
| GET /me | 95 ms |
Código
import { HorizontalBar, RowsChartSkeleton } from '@sypnia/ui/react';
// Long names fit on the left; sorted from the slowest.
export default function Endpoints() {
return (
<div className="sy-stack">
<HorizontalBar title="Slowest endpoints" subtitle="Time to answer, 95th percentile" label="Endpoint" formatValue={(v) => `${v} ms`}
items={[{ label: 'GET /orders?include=items', value: 840 }, { label: 'POST /checkout', value: 620 }, { label: 'GET /products/search', value: 410 }, { label: 'GET /me', value: 95 }, { label: 'POST /login', value: 180 }]} />
<RowsChartSkeleton rows={3} />
</div>
);
} Cuándo usarlo
Úsalo cuando
- Rankings y categorías con nombres largos.
No lo uses cuando
- Valores en el tiempo: usa BarChart o LineChart.
Para todos
- Cada fila se puede enfocar y se nombra con su etiqueta y su valor.
- En celulares la barra va debajo del nombre, a todo el ancho.
Props
| HorizontalBar | Tipo | Por defecto |
|---|---|---|
itemsobligatorio | { label: string; value: number; }[] | |
titleobligatorio | ReactNode | |
empty | ReactNode | |
error | ReactNode | |
formatValue | Fmt | |
height | number | |
keepOrder | boolean | |
labelThe header of the first column of the table view. | string | Name |
loading | boolean | |
loadingRowsOn the first load (`loading` with no items): how many rows will come, drawn as rows of skeleton. Default 5. | number | |
subtitle | ReactNode |
| RowsChartSkeleton | Tipo | Por defecto |
|---|---|---|
rows | number | 5 |