#197
Custom zones
Three gauges (CPU 67, Memory 82, Disk 45) that share colour zones for success, warning and error.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Custom zones" pattern (@codeatlasdev/ui demo #197, charts/gauge) in my app.
Call get_demo({ ids: ["#197"] }) first and keep its structure. It needs @codeatlasdev/[email protected] + echarts.
Use: Resource or SLA dashboards where thresholds change the gauge colour.
Keep these library parts, with the props and tokens the demo uses:
- Card, Grid from "@codeatlasdev/ui"
- GaugeChart, GaugeZone from "@codeatlasdev/ui/charts"
Behaviour to keep:
- `const zones: GaugeZone[]` with 3 entries: `{ until: 0.5, color: 'success' }`, `{ until: 0.8, color: 'warning' }`, `{ until: 1, color: 'error' }`
- `const metrics` with 3 items: CPU `67`, Memory `82`, Disk `45`, fields `label` and `value`
- `{#each metrics as m}` renders `<GaugeChart value={m.value} {zones} height="200px" />`
- Each gauge sits in its own `<Card>` inside `<Grid columns={{ base: 1, sm: 3 }} gap="4">`
Reduced motion: the demo handles it; keep that branch.
Keyboard: not an interactive control.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- Card
@codeatlasdev/ui - Grid
@codeatlasdev/ui - GaugeChart
@codeatlasdev/ui/charts
How it is built
- `const zones: GaugeZone[]` with 3 entries: `{ until: 0.5, color: 'success' }`, `{ until: 0.8, color: 'warning' }`, `{ until: 1, color: 'error' }`
- `const metrics` with 3 items: CPU `67`, Memory `82`, Disk `45`, fields `label` and `value`
- `{#each metrics as m}` renders `<GaugeChart value={m.value} {zones} height="200px" />`
- Each gauge sits in its own `<Card>` inside `<Grid columns={{ base: 1, sm: 3 }} gap="4">`
Related
Loading source.