Data
JS behaviour
Metric chart
A chart with metric tabs: the line morphs into the new series and the headline rolls; deltas take the right colour (and flip for inverse metrics).
Real scenarios
The component as it is used in a product — not a specimen grid.
Workspace health
Twelve months, three metrics on tabs: the line morphs into the new series and the headline rolls. Watch latency — a falling line is good there, so invertDelta flips the delta’s colour.
Workspace health
$52,350
+12.4%
vs last month
| Revenue | Active users | Latency | |
|---|---|---|---|
| Oct | $32,000 | 9,304 | 250 millisecond |
| Nov | $34,589 | 9,302 | 238 millisecond |
| Dec | $37,171 | 9,809 | 228 millisecond |
| Jan | $40,741 | 10,317 | 222 millisecond |
| Feb | $41,399 | 10,268 | 216 millisecond |
| Mar | $43,528 | 10,421 | 210 millisecond |
| Apr | $45,661 | 10,660 | 204 millisecond |
| May | $46,185 | 11,070 | 198 millisecond |
| Jun | $47,294 | 11,480 | 192 millisecond |
| Jul | $48,650 | 11,890 | 186 millisecond |
| Aug | $50,500 | 12,300 | 182 millisecond |
| Sep | $52,350 | 12,710 | 187 millisecond |
One metric, opening on it
active picks the starting tab; height tunes the plot — a half-height card for a sidebar widget.
Tickets resolved
1,311
+6.9%
| Opened | Resolved | |
|---|---|---|
| Oct | 934 | 922 |
| Nov | 1,010 | 1,036 |
| Dec | 1,131 | 1,027 |
| Jan | 1,118 | 1,079 |
| Feb | 1,173 | 1,132 |
| Mar | 1,228 | 1,117 |
| Apr | 1,209 | 1,127 |
| May | 1,217 | 1,147 |
| Jun | 1,236 | 1,188 |
| Jul | 1,278 | 1,229 |
| Aug | 1,320 | 1,270 |
| Sep | 1,362 | 1,311 |
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| labels / metrics | array | [] | Each metric: ['id' => …, 'label' => …, 'values' => […], 'delta' => 12.4, 'format' => [Intl NumberFormat options], 'invertDelta' => true] — as many values as labels. |
| active | string | null | The metric tab that starts selected. |
| title / subtitle / caption | string | null | The title, subtitle and the caption beside the headline. |
| height | int | 200 | The plot height. |
Snippet
<x-nx::metric-chart title="سلامت ورکاسپیس" caption="نسبت به ماه پیش" :labels="$months" :metrics="[
['id' => 'revenue', 'label' => 'درآمد', 'values' => $values, 'delta' => 12.4],
]" />