Skip to main content

Gauge Pro

One value against its range: a health score, a credit score, storage used, a speed. segments color the track by range (poor, fair, good) and the fill takes the color of the range it's in, with the range's name under the value. target marks a goal on the track, and showNeedle swaps the fill for a needle. The arc sweeps to each new value.

import { GaugeChart } from '@patine-ui/pro';

Live data​

Loading…
<View style={{ width: 380, flexDirection: 'row', gap: 12 }}>
  <GaugeChart value={score} segments={health} target={80} accessibilityLabel="Account health" height={170} style={{ flex: 1 }} />
  <GaugeChart value={score} segments={health} showNeedle accessibilityLabel="Account health" height={170} style={{ flex: 1 }} />
</View>

Try the props​

Props
value
target
startAngle
endAngle
thickness
design
<GaugeChart segments={health} value={82} />

Example: a monthly budget​

A spending app's Groceries budget: the gauge fills with what's spent, turns amber past 80% and red past the limit, and the needle-free arc keeps it readable at a glance. Add an expense to watch it move.

Loading…
<View style={{ width: '100%', maxWidth: 360, gap: 8 }}>
  <Text weight="semibold">Groceries · November</Text>
  <GaugeChart
    value={spent}
    max={LIMIT * 1.2}
    segments={[
      { to: LIMIT * 0.8, color: '#16A34A', label: 'On track' },
      { to: LIMIT, color: '#D97706', label: 'Close to the limit' },
      { to: LIMIT * 1.2, color: '#DC2626', label: 'Over budget' },
    ]}
    target={LIMIT}
    label={`€${spent} of €${LIMIT}`}
    height={180}
    accessibilityLabel={`Groceries: €${spent} of €${LIMIT}`}
  />
  <HStack gap="sm" justify="center">
    <Button size="sm" variant="outline" onPress={() => setSpent((s) => s + 42)}>Add €42 shop</Button>
    <Button size="sm" variant="ghost" onPress={() => setSpent(318)}>Reset</Button>
  </HStack>
</View>
Loading…
<View style={{ width: 380, flexDirection: 'row', gap: 12 }}>
  <GaugeChart value={0.68} max={1} valueFormat="percent" label="Storage" startAngle={-90} endAngle={90} height={110} style={{ flex: 1 }} />
  <GaugeChart value={742} min={300} max={850} label="Credit score" thickness={0.08} height={150} style={{ flex: 1 }} />
</View>

Props​

The shared chart props except data, the legend and tooltip props, and:

PropTypeDefaultDescription
valuenumber—
min / maxnumber0 / 100
segments{ to, color?, label? }[]—Colored ranges, each from the last one's end up to to.
targetnumber—A mark on the track.
labelstringthe range's labelUnder the value.
startAngle / endAnglenumber-120 / 120Degrees clockwise from 12 o'clock. -90/90 is a half circle.
thicknessnumber0.16The track's width as a share of the radius.
showNeedlebooleanfalseA needle over the colored ranges instead of a filled arc.
showMinMaxbooleantruemin and max at the arc's ends.
colorstringthe range's, or primaryThe fill.
heightnumber200