Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Chart examples · Radial

A radial chart with a grid for React

A radial bar chart with circular grid lines behind its rings.

Framework
UI library

Concentric rings, one per browser, over circular grid lines that help estimate how far each arc goes. The tooltip names the browser and its count.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How do I add circular grid lines?

PolarGrid sets gridType="circle", so the grid is circles. It sits behind one RadialBar with dataKey="visitors". This file doesn't set background on that bar, so there is no full-circle track behind each arc.

Why are there spokes as well as circles?

PolarGrid leaves radialLines at its default, which is on, so the spokes still render. Set radialLines={false} on that same PolarGrid when you want only the circles.

How thick are the rings?

RadialBarChart sets innerRadius={30} and outerRadius={100}. The five browser rows share that band, and each row's visitors value sets how far its arc runs.

How does the tooltip name each browser?

ChartTooltipContent sets hideLabel and nameKey="browser". hideLabel hides the title. nameKey looks up the row's browser field in config, so the row reads Chrome, Safari, Firefox, Edge, or Other. cursor={false} turns the hover cursor off.

Where does each ring's color come from?

Every chartData row sets fill to var(--color-chrome) and the same pattern for the other browsers. config maps those keys to var(--chart-1) through var(--chart-5). ChartContainer writes the --color- variables.

How do I keep the chart square?

ChartContainer uses mx-auto aspect-square max-h-[250px] inside a w-full max-w-xl frame. That overrides the container's default 16:9 box.