shadcn.io is not affiliated with official shadcn/ui
Chart examples · Radial
A radial chart for React
A radial bar chart with one ring per browser over a muted background track.
Radial bars: one ring per browser, its arc as long as its value, over a muted background track. The tooltip names the browser and its count.
Preview
Installation
FAQ
How do I set the hole and the outer edge?
RadialBarChart sets innerRadius={30} and outerRadius={110}. The five browser rows share that band. Each row's visitors value is how far that arc runs. Chrome is 275 and Other is 90.
What does background draw?
RadialBar sets background and dataKey="visitors". background draws the full-circle track behind each arc, and the chart styles that sector with the muted fill. The colored part is the visitors value.
How does the tooltip name a ring?
ChartTooltipContent sets hideLabel and nameKey="browser". hideLabel drops the title. nameKey reads the row's browser field and looks it up in config, so the row says Chrome, Safari, Firefox, Edge, or Other. cursor={false} turns the hover cursor off.
Where does each ring's color come from?
Each chartData row sets fill to var(--color-chrome) or the matching key. config maps those keys to var(--chart-1) through var(--chart-5), and ChartContainer writes the --color- variables. visitors in config is only the label Visitors.
Related
- A radial chart with textA radial bar chart with one rounded ring
- A radial chart with a labelA radial bar chart labeling each ring
- A radial chart with stacked sectionsA half-circle radial chart stacking
- A bar chartA bar chart with rounded corners
- A simple pie chartA pie chart of visitors by browser, each
- A radial chart with a gridA radial bar chart with circular grid