suiss/uim · Chart

Pie Chart Donut Text

A donut chart with the total user count shown in its center.

Pie Chart Donut Text is an open-source mobile chart from suiss/uim, drawn with react-native-svg for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Pie (donut text) on iOS in light mode

A PieChart donut with small gaps and rounded slice corners. chartData holds one record per device with a users count. The total is summed from chartData and drawn as Text layered over the ring. Pressing a slice shows a tooltip.

Installation

$ pnpm dlx @esuiss/uim@latest add pie-chart-donut-text

The CLI also adds what it builds on: Card, Chart, Text.

Manual

  1. Add the pieces it builds on: Card, Chart, Text.

  2. Copy the source into components/charts/pie-chart-donut-text.tsx:

uniwind/components/charts/pie-chart-donut-text.tsx
import { View } from "react-native"
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
  Pie,
  PieChart,
} from "@/components/ui/chart"
  1. Update the import paths to match your project.

Usage

import { PieChartDonutText } from "@/components/charts/pie-chart-donut-text"
<PieChartDonutText />

Replace chartData with your records; the center total recalculates from it. Update the users caption and chartConfig labels and colors to match. The component takes no props.