# React Native Radial Chart & Activity Rings (Pro)

> A React Native radial chart for iOS, Android and the web: concentric rings that fill toward each goal and glide to new values, like Apple's activity rings, with a track, the first ring's share in the middle, tooltips by touch, pointer or keyboard, loading states and a screen-reader summary.

# Radial chart Pro

Progress toward goals as concentric rings, like Apple's activity rings. Each row is a ring, outermost first, filled to its share of `max` over a faint track. Give every ring the same `max`, or name a row field that holds each ring's own goal. Rings fill from empty on mount and glide to new values as the day goes on.

```tsx
import { RadialChart } from '@patine-ui/pro';
```

## Live data

```tsx live
import { useState } from 'react';
import { View } from 'react-native';
import { Button } from 'patine-ui';
import { RadialChart } from '@patine-ui/pro';

const goals = { Move: 500, Exercise: 30, Stand: 12 };
const roll = () => Object.entries(goals).map(([ring, goal]) => ({ ring, value: Math.round(goal * (0.2 + Math.random() * 0.9)), goal }));

export default function Example() {
  const [data, setData] = useState(roll);
  return (
    <View style={{ width: 340, gap: 8 }}>
      <Button size="sm" variant="outline" onPress={() => setData(roll())} style={{ alignSelf: 'flex-end' }}>Next day</Button>
      <RadialChart
        data={data}
        nameKey="ring"
        valueKey="value"
        max="goal"
        centerLabel="Move"
        series={[{ key: 'Move', color: '#E11D48' }, { key: 'Exercise', color: '#16A34A' }, { key: 'Stand', color: '#0891B2' }]}
        accessibilityLabel="Today's activity"
        height={220}
      />
    </View>
  );
}
```

## Example: savings goals

A banking app's goals: each ring is how far a goal has come against its own target, so a small goal nearly done and a big one just started read fairly side by side.

```tsx live wide
import { View } from 'react-native';
import { HStack, Text, VStack } from 'patine-ui';
import { RadialChart } from '@patine-ui/pro';

const GOALS = [
  { goal: 'Holiday', saved: 1840, target: 2400, color: '#0891B2' },
  { goal: 'New laptop', saved: 950, target: 1600, color: '#7C3AED' },
  { goal: 'Emergency fund', saved: 3100, target: 10000, color: '#16A34A' },
];

export default function Example() {
  return (
    <View style={{ width: '100%', maxWidth: 520, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: 16 }}>
      <RadialChart
        data={GOALS}
        nameKey="goal"
        valueKey="saved"
        max="target"
        centerLabel="Holiday"
        series={GOALS.map((g) => ({ key: g.goal, color: g.color }))}
        height={220}
        accessibilityLabel="Savings goals"
        style={{ flex: 1, minWidth: 220 }}
      />
      <VStack gap="sm" style={{ flex: 1, minWidth: 200 }}>
        {GOALS.map((g) => (
          <HStack key={g.goal} justify="space-between">
            <Text>{g.goal}</Text>
            <Text color="textSecondary">€{g.saved.toLocaleString()} of €{g.target.toLocaleString()}</Text>
          </HStack>
        ))}
      </VStack>
    </View>
  );
}
```

## Fixed goals

```tsx live
import { RadialChart } from '@patine-ui/pro';

const data = [
  { ring: 'Move', value: 420, goal: 500 },
  { ring: 'Exercise', value: 24, goal: 30 },
  { ring: 'Stand', value: 9, goal: 12 },
];

export default function Example() {
  return (
    <RadialChart
      data={data}
      nameKey="ring"
      valueKey="value"
      max="goal"
      centerLabel="Move"
      series={[{ key: 'Move', color: '#E11D48' }, { key: 'Exercise', color: '#16A34A' }, { key: 'Stand', color: '#0891B2' }]}
      accessibilityLabel="Today's activity"
      height={220}
      style={{ width: 320 }}
    />
  );
}
```

## Props

The [shared chart props](./charts#shared-props), and:

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `nameKey` | `string` | — | The row field naming each ring. |
| `valueKey` | `string` | — | The row field with each ring's value. |
| `max` | `number \| string` | `100` | A full ring: one number, or a row field with each ring's goal. |
| `series` | `{ key, label?, color? }[]` | — | Labels and colours, matched to `nameKey`. |
| `centerLabel` | `string` | — | Shows the first ring's share in the middle, with this under it. |
