Charts
GaugeChart
KPI gauges, progress rings and animated counters.
<script>
import { GaugeChart } from "@codeatlasdev/ui/charts";
</script>
<GaugeChart value={78} label="Score" />
<GaugeChart value={65} variant="ring" />
The default gauge colors its arc in three zones (error, warning, success). Override them with zones, where until is a fraction of min to max.
Simple gauge
Code
Progress ring
variant ring draws a single brand-colored arc with the value in the center.
Code
Custom zones
Reverse the default zones when a high value is bad, such as CPU load.
CPU
Memory
Disk
Code
Animated counter
Updating value animates the ring and the number.
Needs work
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | – | Current value. |
min | number | 0 | Lower bound of the scale. |
max | number | 100 | Upper bound of the scale. |
variant | 'default' | 'ring' | 'default' | 'default' is a speedometer arc with a pointer. 'ring' is a full progress ring. |
zones | GaugeZone[] | error to 0.3, warning to 0.7, success to 1 | Colored arc zones as { until, color }. until is a fraction of min to max; color is success, warning, error, info, brand or any CSS color. |
label | string | – | Caption shown above the value in the default variant. |
formatter | (value: number) => string | v => `${v}%` | Formats the displayed value. |
animated | boolean | true | Animates the displayed value between updates. |
height | string | '280px' | CSS height of the chart. |
class | string | '' | Extra class names. |