KPI · Basic

Gauge

One KPI's current value against its target.

Open in playground
Use when
Showing one value against its target, large
Avoid when
Comparing several values

Try it

18

Gauge

Quarterly revenue goal (%)
GaugeGauge. Goal reached 73%, range 0 to 100, target 85%.73%Goal reachedTarget 85
Gauge data
Goal reached73% / target 85%
12 points left to the goalBasic

Hover over the chart, or Tab in and use the arrow keys to move between items. The numbers are sample data.

Variants

Named looks for this chart. Each one is the example above with a few options or fields changed. The CLI (ztd-charts example gauge --variant <id>) and the MCP server know the same names.

Half circle

Quarterly revenue goal (%)
Sample data

Progress ring

Quarterly revenue goal (%)
Sample data

Lit ticks

Quarterly revenue goal (%)
Sample data

Code

GaugeChart.tsx
import { ChartCard, GaugeChart } from "ztd-charts";

const data = [
  {"label":"Goal reached","value":73,"target":85},
];

export function Example() {
  return (
    <ChartCard number="18" title="Gauge" subtitle="Quarterly revenue goal (%)" takeaway="12 points left to the goal" level="basic" replay>
      <GaugeChart
        data={data}
        valueKey="value"
        targetKey="target"
        label="Goal reached"
        unit="%"
      />
    </ChartCard>
  );
}

Props

<GaugeChart> takes these props. Rows marked Common work the same on every chart.

30 props

Prop
dataRequiredAn array of objects. Pass CSV, REST or database rows as they areobject[]
valueKeyRequiredValue fieldstring | (d, i) => number
targetKeyTarget fieldstring | (d, i) => number
minMinimumnumberDefault 0
maxMaximumnumberDefault 100
labelCaption in the centerstring
variantShape. ticks lights tick marks up to the value"arc" | "semi" | "ring" | "ticks"Default "arc"
bandsBand boundaries (arc, semi)number[]
ticksTick count when variant=ticks. Fits the size by defaultnumber
heightCommonHeight in px. Without it, each chart picks a default that fits its widthnumber
widthCommonFixed width in px. Without it, the chart fits its parentnumber
highlightCommonItem to highlight. An index, a name, an array, or "max" | "min" | "first" | "last" | "none"number | string | (number|string)[] | "max" …
formatCommonValue format. "number" | "integer" | "percent" (values are already percents: 42 → "42%") | "ratio" (0.42 → "42%") | "compact" | "currency" (KRW for Korean locales, otherwise USD; for another currency pass Intl options with currency) | "decimal" or Intl.NumberFormat options"number" | "percent" | "compact" | …
unitCommonUnit appended to values. For example "%" or "ms"string
localeCommonLocale for numbers, dates and the text a chart writes itself (tooltips, screen reader sentences). "ko" or "ko-*" switches to Korean. Falls back to the ThemeProvider localestringDefault "en-US"
animateCommonEntry and update animationbooleanDefault true
durationCommonAnimation length (ms)number
easingCommonMotion curve"spring" | "easeOut" | "easeInOut" | "linear"Default "spring"
staggerCommonDelay between items as they enter (ms)number
reducedMotionCommon"auto" follows the OS setting. true always turns motion offanyDefault "auto"
animateOnViewCommonPlay when the chart scrolls into viewbooleanDefault true
showLabelsCommonLabels drawn on the chart (values and names)booleanDefault true
tooltipCommonShow tooltips. { template: "{label} · {value} · owner {owner}" } writes them: {label}, {value}, {series} or any other column of the row. \n starts a new line, and a line with an empty value is left outtooltipDefault true
syncIdCommonCharts with the same syncId show the hovered x together (line, area, bar, candlestick). <ChartGrid sync> sets one for every chart inside itstring
ariaLabelCommonName for screen readersstring
descriptionCommonDescription for screen readers. Built from the data when omittedstring
onHoverCommonRuns when hover or keyboard focus moves to another item(e: ChartEvent | null) => void
onClickCommonRuns on click, Enter or Space(e: ChartEvent) => void
replayKeyCommonReplays the entry animation when it changesstring | number
themeCommonChanges theme tokens for this chart onlyPartial<ChartTheme>