shadcn.io is not affiliated with official shadcn/ui
Chart examples · Radial
A radial chart with a custom shape for React
A radial bar chart with one partial ring, a custom grid and the value in its center.
A gauge-like radial chart: one ring drawn over a 100 degree arc on a muted track, with decorative inner circles from PolarGrid and the value in the center. Use it for a single number shown as progress.
Preview
Installation
FAQ
How do I make the ring a short arc?
RadialBarChart sets endAngle={100} and leaves startAngle at its default, 0, which is the right side of the circle. The bar runs 100 degrees from there. innerRadius={80} and outerRadius={140} set the band.
How does the center get its number?
PolarRadiusAxis hides its axis with axisLine={false}, tick={false}, and tickLine={false}, and renders a Label whose content is renderValue. That function reads viewBox.cx and viewBox.cy, then prints chartData[0].visitors with toLocaleString and the caption Visitors.
What are the two circles inside the arc?
PolarGrid sets gridType="circle", polarRadius={[86, 74]}, radialLines={false}, and stroke="none". The className fills the first circle with fill-muted and the last with fill-background. Those radii are decoration. They are not a second data series.
What does background on the bar do?
RadialBar sets background and dataKey="visitors". background draws the full track for the 100 degree span, and the chart styles that track with the muted fill. The colored arc is the visitors value, 1260.
Related
- A radial chart with textA radial bar chart with one rounded ring
- A radial chartA radial bar chart with one ring per
- A donut chart with textA donut chart with the total number of
- A radial chart with stacked sectionsA half-circle radial chart stacking
- A bar chartA bar chart with rounded corners
- A radial chart with a gridA radial bar chart with circular grid