KPI stat
A key figure with its change against the previous period and a sparkline of the period, on the kit's Stat.
- Domaine
- Affichage de données
- Niveau de support
- Taille
- Non mesurée
- Qui l'utilise
- Aucun produit en production ne l'importe encore
import { KpiStat } from "@krizaka/charts/card";Web uniquement — React, depuis @krizaka/charts/card. Bêta : son API peut encore changer à une version mineure.
- Mobile · ✗ à construire. A phone dashboard's head writes its figures by hand today. issue #275
Pourquoi il est là. Used by Sovkora.
Quand l’utiliser
- The head of a dashboard: jobs, success rate, time to a result, spend.
- Anywhere a figure needs its direction and its shape at a glance.
Quand ne pas l’utiliser
- A chart the reader will explore.À la place : Line chart
- A value against a limit.À la place : Gauge
Installation
Installer
npm install @krizaka/chartsImporter
import { KpiStat } from "@krizaka/charts/card";Exemples
A dashboard row
Four figures in a StatGrid, with sparklines and trends.
One figure
A rise in latency is bad: good=down.
Props
A key figure, its change against the previous period and the shape of the period.
| Prop | Type | Défaut | Description |
|---|---|---|---|
labelrequis | string | — | What the figure is (“Jobs”). |
valuerequis | number | — | The figure for the period. |
brand | BrandId | — | The brand whose palette the charts use. Without it, a chart follows a .brand-<id> ancestor, else Krizaka. Set it
when the app loads a brand stylesheet on :root (@krizaka/tokens/brands/sovkora.css). |
categories | readonly unknown[] | — | The labels of data (dates), for the sparkline's summary and table. |
color | SeriesColor | — | The sparkline's colour. Default: the brand's. |
data | readonly (number | null)[] | — | The shape of the period, oldest first (null for a gap). Without it, no sparkline. |
format | ValueFormat | — | How it is written. Default "number". |
good | "up" | "down" | up | Which direction is good news. Default "up"; "down" for latency, failures, spend. |
hint | ReactNode | — | A line under the value: the period, the comparison. |
labels | ChartLabelsInput | — | The words, translated: the buttons, the states, the written summary. |
locale | Locale | — | The locale of every figure and date ("fr-FR"). Default "en-US". |
previous | number | — | The same figure for the previous period: the trend is computed from it. |
trendLabel | ReactNode | — | Your own words for the change instead of “+12 % vs previous period”. |
variant | "area" | "line" | "bar" | area | bar for discrete counts (jobs per day), area (default) or line. |
Accessibilité
- The change is written (
+24 % vs previous period), never colour or arrow alone. - The sparkline has its own accessible summary; the figure is read as text.
Bonnes pratiques
- Pass
previousand the trend is computed and written in words; the arrow is only decoration. - Use
good=downfor latency, failures and spend: the arrow's colour says whether the change is good news. - Put several in a
StatGridof the kit: they wrap with the width.
Composants liés
Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub