Charts
GaugeChart
A single bounded value on a dial — an arc over a restricted sweep, with the exact number in the middle. Good for a status summary; a `Progress` bar is the better read when the value needs comparing to another one.
<UiGaugeChart :modelValue="..." :ariaLabel="..." />Needs the charts module
This component ships in @jgastager/bundy-ui/charts, a separate module so projects that never draw a chart don't carry the paint classes these need. Nothing extra to install — just add the module entry. See Charts.
Options
One block per prop — what it does, and what it looks like set.
Model value
requiredmodelValue is the reading. It's clamped into min…max before it's drawn, so an out-of-range value pins the arc rather than overshooting it. An array breaks one reading into the parts that make it up — the arc still ends at the total, with the split visible inside it.
- Documents
- Media
- Backups
An array is a breakdown of one reading, not several readings: the entries are lengths stacked from min, so the arc still reports a single total and the readout is what they add up to. Several independent values want separate gauges, or a RadialBarChart.
The hover fade is a CSS transition over the library's own 250ms duration, so it costs nothing and honours prefers-reduced-motion. There's no animate prop and nothing tweens on a data change — the marks are plain SVG elements Vue patches directly.
ARIA label
requiredariaLabel is required. A gauge is a single number drawn as an angle — this is what makes that number available at all without sight.
ARIA description
ariaDescription is the detail the label shouldn't carry — a threshold, a trend, what happens at the top of the range.
Min
min is the bottom of the range. Raise it when zero isn't a meaningful floor — a temperature, a score that starts at 200 — so the arc spends its length on the part that varies.
model-value is clamped into min…max before drawing, so an out-of-range value shows a full or empty dial rather than an arc that wraps around.
Max
max is the top of the range, and what the percentage readout is a percentage of. Set it to the real ceiling rather than the largest value you happen to have.
Label
label is the text under the readout, naming what's being measured. Without it the gauge is a number with no subject.
Labels
labels names a breakdown's segments, in the same order as the values. Without them the parts are unexplained colors: the middle of the gauge belongs to the total, so the legend is the only place their names can go.
- Documents
- Media
- Backups
Display
display replaces the center readout wholesale. Reach for it when the number to show isn't a function of the value — a grade, a status word, a fraction.
Value format
valueFormat formats the center readout, which otherwise shows the percentage of the range. It formats each segment's value in the legend too, so a breakdown's parts read in the same units as its total.
Sweep
sweep sets how far around the circle the track runs, centred on twelve o'clock. 270 is the classic dial; 180 is the half-circle that sits under a stat tile without wasting the height a full dial needs.
sweep="180" is a half-circle that stacks tightly in a row of stat tiles; the default 270° is the classic dial.
Thickness
thickness is the arc's width as a fraction of the radius. Thin reads as precise, thick as a status light — pick from how the number is meant to be used, not from how much room there is.
Gap
gap separates a breakdown's segments, in degrees. It's taken out of the joins only — the two ends of the run are where the reading is, so a gap there would change the number the arc reports.
Color
color paints the filled arc — and the first segment of a breakdown, so it keeps doing the obvious thing when a single reading later grows a split. Binding it to a threshold is the usual move: the gauge then changes meaning as the value crosses one, without any extra chrome.
Colors are the library's own semantic ones — primary, secondary, success, warning, error, info, pending, neutral — and any shade of them, primary-400 through primary-950, exactly as the bg-* utilities spell them. Set color per series (or per item) to pin one; leave it unset to take the next slot of the default sequence. neutral and secondary are never handed out automatically, so an unlabelled series never lands on them.
Colors
colors paints a breakdown's segments, positionally. Left unset they take the library's default sequence, which is ordered so neighbouring pairs stay apart for a colorblind reader — set it when the parts carry meanings of their own, like an Other bucket that should recede.
- Documents
- Media
- Backups
- Documents
- Media
- Backups
Track color
trackColor paints the unfilled remainder. Lighten it on a raised surface so the track doesn't read as a hole punched through the card.
Tooltip
tooltip names what's under the pointer on hover. On a breakdown that's the segment, identified without tracing its color back to the legend; on a single reading it's the value the other way round from the readout — the percentage of the range beside the number in its own units. Only the filled arc answers: the track past the reading is the remainder, not a datum.
- Documents · 38 GB
- Media · 22 GB
- Backups · 12 GB
- Documents · 38 GB
- Media · 22 GB
- Backups · 12 GB
Only the filled arc is hoverable. The track past the reading is the remainder rather than a datum, so a pointer over it closes the panel instead of holding the last segment's open — and the middle belongs to the readout, not to the arc. Hovering a breakdown also dims the segments that aren't under the pointer.
Animate
animate is on by default: the arc sweeps up from min on the first draw and eases to each new reading. Roll new values to compare it with the chart on the right, which has it off. Only the arc moves — the readout always shows the real number — and a reader who has asked their system for reduced motion gets no motion either way.
Legend
legend lists a breakdown's segments under the gauge. It needs labels — there's nothing to name without them — and never appears on a single reading, whose readout and label already say what it is.
- Documents
- Media
- Backups
Legend position
legendPosition puts the legend above the gauge instead of below it. Above works when the gauge sits at the bottom of a tile and the names are what the eye should meet first.
- Documents
- Media
- Backups
- Documents
- Media
- Backups
Legend align
legendAlign places the entries across the legend's width. Centred by default, since the gauge it belongs to is centred too.
- Documents
- Media
- Backups
- Documents
- Media
- Backups
- Documents
- Media
- Backups
Legend orientation
legendOrientation stacks the entries one per line. Worth it once the labels are long enough to wrap, or when valueFormat prints a value beside each one.
- Documents
- Media
- Backups
- Documents · 38 GB
- Media · 22 GB
- Backups · 12 GB
Legend group
legendGroup names a group that a standalone UiChartLegend with the same group belongs to, so the legend can sit anywhere — here above the plot — and still dim the other segments while you hover an entry. The chart hands the legend its entries, colors included, so it needs no items. Switch the chart's own legend off if you don't want two.
Height
height is the plot's height in pixels; the arc is sized to fit inside it. It's ignored once aspectRatio is set.
Aspect ratio
aspectRatio sizes the gauge from its container's width instead of a fixed height.
Loading
loading is a skeleton at the gauge's exact height, so a tile doesn't resize when the reading lands.
Examples
The component in real use: compositions that answer "how do I build X with this", rather than one prop at a time.
When a Progress is the better read
A gauge spends a lot of space on one number. If the value is a straightforward completion — a form, an upload, a quota bar in a settings row — a Progress says the same thing in a line.
The readout in the middle isn't decoration — arc length gives a rough read at best, so the exact number is what the viewer actually takes away.
Good at "roughly where in the range am I", poor at comparison: two dials side by side are much harder to rank than two bars. If the value needs comparing to another one, use Progress.
API Reference
Generated from the component's source — props, slots and emits as the component actually declares them.
Props
modelValuerequirednumber | number[]string[](value: number) => stringnumber270number2ChartColorName[]ChartColorName'neutral-800'booleantruebooleantruebooleantruestringTypes
interface ChartPlot {
x: number;
y: number;
width: number;
height: number;
/** Right edge, since marks need it more often than the width. */
right: number;
/** Bottom edge, which is also the x axis' baseline. */
bottom: number;
}type ChartColorName = ChartColorFamily | `${ChartColorFamily}-${ChartColorShade}` | `[${string}]`;