Card with a radar chart scoring six listening moods out of 100, each axis label carrying its score so the values read without the shape. Client component on recharts 3.8.
"use client"
import { PolarAngleAxis, PolarGrid, Radar, RadarChart } from "recharts"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import {
ChartContainer,
ChartTooltip,
ChartTooltipContent,
type ChartConfig,
} from "@/components/ui/chart"
// The copy: change text here, not in the markup.
const COPY = {
title: "Listening profile",
description: "How October's listening splits by mood, out of 100",
} as const
const MOODS = [
{ mood: "Calm", score: 82 },
{ mood: "Focus", score: 74 },
{ mood: "Warm", score: 63 },
{ mood: "Bright", score: 38 },
{ mood: "Energy", score: 46 },
{ mood: "Dark", score: 55 },
]
const CHART_CONFIG = {
score: { label: "Score", color: "var(--chart-2)" },
} satisfies ChartConfig
// Each axis prints its score, so the shape is never the only record of it.
const SCORES = new Map(MOODS.map((entry) => [entry.mood, entry.score]))
export default function RadarChart01() {
return (
<Card className="mx-auto w-full max-w-md">
<CardHeader>
<CardTitle>
<h2>{COPY.title}</h2>
</CardTitle>
<CardDescription>{COPY.description}</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer
config={CHART_CONFIG}
className="mx-auto aspect-square max-h-72"
>
<RadarChart
accessibilityLayer
data={MOODS}
outerRadius="62%"
margin={{ left: 24, right: 24 }}
>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent hideLabel />}
/>
<PolarGrid />
{/* Stock ChartContainer's label color misses recharts 3's label layer. */}
<PolarAngleAxis
tick={{ fill: "var(--muted-foreground)" }}
dataKey="mood"
tickFormatter={(mood: string) => `${mood} ${SCORES.get(mood)}`}
/>
<Radar
dataKey="score"
fill="var(--color-score)"
fillOpacity={0.2}
stroke="var(--color-score)"
strokeWidth={2}
dot={{ r: 3, fillOpacity: 1 }}
/>
</RadarChart>
</ChartContainer>
</CardContent>
</Card>
)
}
pnpm dlx shadcn add @01orbital/radar-chart-01npx shadcn add @01orbital/radar-chart-01yarn shadcn add @01orbital/radar-chart-01bunx --bun shadcn add @01orbital/radar-chart-01Free under the MIT license. Add the @01orbital registry to components.json once (install guide), then run the command.
It lands at components/blocks/charts/radar-chart-01/index.tsx, as source you own and edit.
import RadarChart01 from "@/components/blocks/charts/radar-chart-01"
export default function Example() {
return <RadarChart01 />
}npm: recharts@3.8.0. The CLI installs them for you.
Registry pieces it installs with it:
cardchartListeners Area Chart Card
Card with a two-series area chart of daily listeners, desktop solid and mobile dashed, a select for 90, 30 or 7 days and a legend that draws the dash. Client component on recharts 3.8.
Monthly Column Bar Chart
Card with a monthly column chart of sessions, the value printed above each rounded bar, and a footer with a trend sentence and icon plus a note. Client component on recharts 3.8.