shadcn.io is not affiliated with official shadcn/ui
About
Reach for a radar when one thing is measured on several comparable dimensions and the overall shape is the point: a skill profile, a product's scores, six months of traffic. For a trend over time, a line chart is clearer; for exact comparisons, use bars.
Each month sits on its own spoke, and its value sets how far from the center that corner lands. Four polygon rings behind the shape mark the scale, and the shape is filled at 60% so the rings show through.
Installation
Usage
import { ChartRadarSimple } from "@/components/charts/chart-radar-simple";<ChartRadarSimple />Customize
<RadarChart data={chartData}>holds the rows.<PolarAngleAxis dataKey="month">puts a month on each spoke and<Radar dataKey="desktop">draws the shape.<PolarGrid />draws polygon rings and spokes by default;gridTypeandradialLineschange that.fill="var(--color-desktop)"andfillOpacity={0.6}color the shape fromchartConfig.ChartTooltipContentwith its default dot shows the month and the value;cursor={false}turns off the hover highlight.ChartContainerismx-auto aspect-square max-h-[250px], so<RadarChart>gets a square to fill.
FAQ
How many categories can a radar hold?
Five to eight spokes read well. With fewer than five, a bar chart says the same thing more clearly. Past eight, the labels crowd each other and the shape stops meaning much. Each row of chartData adds a spoke.
How do I put a different category at the top?
Recharts starts at 90 degrees, the top, and runs clockwise to -270. Set startAngle and endAngle on <RadarChart> to turn it, or reorder chartData.
Why doesn't the shape reach the outer ring?
Recharts picks the radius domain from the data and rounds it up. To fix it, add <PolarRadiusAxis domain={[0, 400]} tick={false} axisLine={false} />.
How do I change the fill?
fillOpacity={0.6} on <Radar> lets the grid show through. Set it to 0 with a stroke and strokeWidth for an outline; fill reads var(--color-desktop).
API Reference
ChartContainer
configChartConfig
Each series by its data key: its label, an icon, and a color (or a * theme color per light and dark), read by the tooltip and legend and set * as --color-<key>.
initialDimension?{ height: number; width: number; }
The size it renders at before it's measured, so the first paint isn't * empty.
- Type
{ height: number; width: number; }- Default
INITIAL_DIMENSION
className?string
Merged with the part's classes.
ChartLegend
ChartLegendContent
<div>
hideIcon?boolean
Hides each series' icon (from config), leaving its color swatch.
- Default
false
nameKey?string
The key in each legend item's data to look its label up by in config. * Defaults to the item's dataKey.
className?string
Merged with the part's classes.
ChartStyle
<style>
configChartConfig
The chart config whose colors it writes as --color-<key> variables.
idstring
The element's id.
ChartTooltip
ChartTooltipContent
<div>
hideIndicator?boolean
Hides each item's color indicator.
- Default
false
hideLabel?boolean
Hides the tooltip's label, the hovered point's.
- Default
false
indicator?"dashed" | "dot" | "line"
The color indicator's shape: a dot, a line or dashed.
- Type
"dashed" | "dot" | "line"- Default
"dot"
labelFormatter?(label: any, payload: TooltipPayload) → React.ReactNode
Formats the tooltip's label; its value is untyped, as in recharts 3.8.
- Type
(label: any, payload: TooltipPayload) → React.ReactNode- Parameters
label– anypayload– TooltipPayload- Returns
React.ReactNode
labelKey?string
The key in the data to read the label from, looked up in config.
nameKey?string
The key in each item's data to look its name up by in config.
className?string
Merged with the part's classes.
Related
Multiple Radar Chart
Radar chartsTwo series overlaid on the same radar grid.
Radar Chart with Dots
Radar chartsA radar with a dot on every value.
Radar Chart with Circle Grid
Radar chartsA radar on circular grid rings instead of polygons.
Radar Chart with Lines Only
Radar chartsTwo radar series as outlines only, no fill.
Bar Chart
Bar chartsOne series of rounded vertical bars, a month each.
Radial Chart
Radial chartsOne ring per browser, each as long as its share.