nyuchimzizi
Mzizi — an open-architecture project of the Bundu Foundation, operated and developed by Nyuchi. Built on the Five African Minerals palette.
Built by Nyuchi Africav4.0.39
Radial chart — stacked variant.
View the full component source code below.
"use client"
import { RadialBar, RadialBarChart, PolarRadiusAxis, Label } from "recharts"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@/components/ui/chart"
const DEFAULT_DATA = [{ harare: 1260, nairobi: 970 }]
const config = {
harare: { label: "Harare", color: "var(--color-cobalt, #00B0FF)" },
nairobi: { label: "Nairobi", color: "var(--color-tanzanite, #B388FF)" },
} satisfies ChartConfig
export function ChartRadialStacked({ loading = false }: { loading?: boolean } = {}) {
return (
<Card role="figure" data-slot="chart-block" data-portal="https://design.nyuchi.com/components/chart-block" aria-label="Radial chart">
<CardHeader>
<CardTitle>Radial Chart - Stacked</CardTitle>
<CardDescription>Stacked radial bars</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={config} loading={loading} className="mx-auto aspect-square max-h-[250px]">
<RadialBarChart data={DEFAULT_DATA} endAngle={180} innerRadius={80} outerRadius={130}>
<ChartTooltip content={<ChartTooltipContent />} />
<PolarRadiusAxis tick={false} tickLine={false} axisLine={false}>
<Label
content={({ viewBox }) => {
if (viewBox && "cx" in viewBox && "cy" in viewBox) {
return (
<text x={viewBox.cx} y={viewBox.cy} textAnchor="middle">
<tspan
x={viewBox.cx}
y={(viewBox.cy || 0) - 16}
className="fill-foreground text-2xl font-bold"
>
2,230
</tspan>
<tspan
x={viewBox.cx}
y={(viewBox.cy || 0) + 4}
className="fill-muted-foreground"
>
Visitors
</tspan>
</text>
)
}
}}
/>
</PolarRadiusAxis>
<RadialBar
dataKey="harare"
stackId="a"
cornerRadius={5}
fill="var(--color-harare)"
className="stroke-transparent stroke-2"
/>
<RadialBar
dataKey="nairobi"
stackId="a"
cornerRadius={5}
fill="var(--color-nairobi)"
className="stroke-transparent stroke-2"
/>
</RadialBarChart>
</ChartContainer>
</CardContent>
</Card>
)
}
npx shadcn@latest add https://mzizi.dev/api/v1/ui/chart-radial-stackedFetch this component's metadata and source code from the registry API.
/api/v1/ui/chart-radial-stackedcomponents/blocks/charts/chart-radial-stacked.tsx