ChartPieExample() — ui Function Reference
Architecture documentation for the ChartPieExample() function in chart-example.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD caf0cff3_3378_61cd_301d_bca1f0b9c8d8["ChartPieExample()"] 8468fea9_9e33_fada_d1d2_6f2ff6de5fa4["chart-example.tsx"] caf0cff3_3378_61cd_301d_bca1f0b9c8d8 -->|defined in| 8468fea9_9e33_fada_d1d2_6f2ff6de5fa4 style caf0cff3_3378_61cd_301d_bca1f0b9c8d8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/registry/bases/radix/examples/chart-example.tsx lines 332–413
function ChartPieExample() {
const totalVisitors = React.useMemo(() => {
return pieChartData.reduce((acc, curr) => acc + curr.visitors, 0)
}, [])
return (
<Example title="Pie Chart">
<Card className="w-full">
<CardHeader className="items-center pb-0">
<CardTitle>Pie Chart - Donut with Text</CardTitle>
<CardDescription>January - June 2024</CardDescription>
</CardHeader>
<CardContent className="flex-1 pb-0">
<ChartContainer
config={pieChartConfig}
className="mx-auto aspect-square max-h-[250px]"
>
<PieChart>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent hideLabel />}
/>
<Pie
data={pieChartData}
dataKey="visitors"
nameKey="browser"
innerRadius={60}
strokeWidth={5}
>
<Label
content={({ viewBox }) => {
if (viewBox && "cx" in viewBox && "cy" in viewBox) {
return (
<text
x={viewBox.cx}
y={viewBox.cy}
textAnchor="middle"
dominantBaseline="middle"
>
<tspan
x={viewBox.cx}
y={viewBox.cy}
className="fill-foreground text-3xl font-bold"
>
{totalVisitors.toLocaleString()}
</tspan>
<tspan
x={viewBox.cx}
y={(viewBox.cy || 0) + 24}
className="fill-muted-foreground"
>
Visitors
</tspan>
</text>
)
}
}}
/>
</Pie>
</PieChart>
</ChartContainer>
</CardContent>
<CardFooter className="flex-col gap-2">
<div className="flex items-center gap-2 leading-none font-medium">
Trending up by 5.2% this month{" "}
<IconPlaceholder
lucide="TrendingUpIcon"
tabler="IconTrendingUp"
hugeicons="ChartUpIcon"
phosphor="TrendUpIcon"
remixicon="RiLineChartLine"
className="size-4"
/>
</div>
<div className="text-muted-foreground leading-none">
Showing total visitors for the last 6 months
</div>
</CardFooter>
</Card>
</Example>
)
Domain
Subdomains
Source
Frequently Asked Questions
What does ChartPieExample() do?
ChartPieExample() is a function in the ui codebase, defined in apps/v4/registry/bases/radix/examples/chart-example.tsx.
Where is ChartPieExample() defined?
ChartPieExample() is defined in apps/v4/registry/bases/radix/examples/chart-example.tsx at line 332.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free