suiss/ui · Chart
Pie Chart Nested
Two concentric pies: an inner ring of grouped totals surrounded by an outer ring of individual categories.
Pie Chart Nested is an open-source chart from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Two concentric rings: a lighter inner pie of group totals surrounded by an outer ring of individual categories. Use it for two-level breakdowns, such as product lines and the products within them.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
- Install the dependencies:
-
Copy the source into
components/charts/pie-chart-nested.tsx:
- Update the import paths to match your project.
Usage
Put the detailed records in chartData and the group totals in groups, making sure each group total matches the sum of its categories. Order the outer categories so each group's members sit together, aligned with their inner slice.
Notes
In the demo the inner groups reuse the Phone and Watch keys even though they combine several categories, so their tooltips read Phone and Watch. Give each group its own key and label in chartConfig to avoid confusion.

A PieChart with two Pie layers. The inner pie reads a groups array and is drawn at reduced opacity; the outer ring reads chartData, one record per device. Pressing a slice in either ring shows a tooltip.
Installation
The CLI also adds what it builds on: Card, Chart.
Manual
-
Target iOS 17 or later.
-
Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Set
minSdkto 24 or higher and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Replace groups and chartData with your summary and detail records, and add each name to chartConfig with its label and color. The component takes no props.
