Polar Area Chart for React
A React polar area chart, Nightingale's rose, draws one wedge per category around a circle, its area proportional to the value. Pass data as readonly ChartRow[]: one row per wedge.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/polar-area-chart.jsonCauses of mortality, 1854–55
- Preventable disease
- Wounds
- Other causes
PolarAreaChartPolarAreaTablefoldPolarSeriespolarAreaLegenddefaultPolarAreaChartLabels- +3 more
Nightingale's rose, 1854–55
Her own data: most soldiers died of preventable disease, not wounds. Areas are true to the values; switch to radius scaling to see how it would exaggerate the winter.
Causes of mortality in the army in the East
Deaths per month from April 1854 to March 1855, by cause
- Preventable disease
- Wounds
- Other causes
import { ChartCard } from "@/components/sheenui/charts/chart-parts/chart-card";
import { type ChartRow, type ChartSeries } from "@/components/sheenui/charts/chart-utils";
import { polarAreaLegend, PolarAreaTable, PolarAreaChart } from "@/components/sheenui/charts/polar-area-chart";
// Package build (after the first npm release, or a packed tarball): import { ChartCard, polarAreaLegend, PolarAreaTable, PolarAreaChart, type ChartRow, type ChartSeries } from "@sheenui/theme";
const series: ChartSeries[] = [
{ key: "disease", label: "Preventable disease", color: 7 },
{ key: "wounds", label: "Wounds", color: 8 },
{ key: "other", label: "Other causes", color: 4 },
];
const data: ChartRow[] = [
{ month: "Apr 1854", disease: 110, wounds: 0, other: 5 },
{ month: "May", disease: 95, wounds: 0, other: 9 },
{ month: "Jun", disease: 40, wounds: 0, other: 6 },
{ month: "Jul", disease: 140, wounds: 5, other: 9 },
{ month: "Aug", disease: 220, wounds: 9, other: 6 },
{ month: "Sep", disease: 360, wounds: 23, other: 14 },
];
export function Example() {
return (
<ChartCard
title="Causes of mortality"
legend={polarAreaLegend(series)}
table={<PolarAreaTable data={data} index="month" series={series} />}
>
<PolarAreaChart data={data} index="month" series={series} scale="area" aria-label="Deaths by cause and month" />
</ChartCard>
);
}Files to copy
15 folders · 33 files · 4 packages
- From
theme/src/ components/charts/{polar-area-chart.tsx, category-bar.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-pointer.tsx, chart-tip.tsx, chart-utils.ts, heatmap.tsx}components/button/components/charts/category-bar/components/charts/chart-parts/components/charts/heatmap/components/drawer/parts/sheet.tsxcomponents/kbd/components/menu/components/skeleton/components/spinner/components/status-icons/hooks/{use-controllable.ts, use-direction.ts, use-intersection.ts, use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}motion/{gate.ts, tokens.ts}lib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, state-light.tsx, warn-once.ts}styles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/polar-area-chart.jsonRegistry item: polar-area-chart. The styles need the Tailwind v4 glass UI setup.- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".
24 hours of traffic
One series, one hue: position and name tell the wedges apart. With 24 names around the rose, labels thin out on narrow screens instead of colliding.
Sessions by hour
Average weekday, local time
import { type ChartRow } from "@/components/sheenui/charts/chart-utils";
import { PolarAreaChart } from "@/components/sheenui/charts/polar-area-chart";
// Package build (after the first npm release, or a packed tarball): import { PolarAreaChart, type ChartRow } from "@sheenui/theme";
// Average sessions per hour of the day (every 4th hour shown here)
const hourly: ChartRow[] = [
{ hour: "00:00", sessions: 120 },
{ hour: "04:00", sessions: 95 },
{ hour: "08:00", sessions: 540 },
{ hour: "12:00", sessions: 610 },
{ hour: "16:00", sessions: 480 },
{ hour: "20:00", sessions: 1290 },
];
export function Example() {
return (
<PolarAreaChart
data={hourly}
index="hour"
series={[{ key: "sessions", label: "Sessions", color: 7 }]}
aria-label="Sessions by hour of day"
/>
);
}Props
PolarAreaChartLabels keys and English defaults (5)
PolarAreaTable props
Keyboard
Accessibility
- The chart is one focusable figure; each wedge read by keyboard announces every series' value (and the total) once.
- Areas are true to the values by default, so the picture never exaggerates big wedges; the ring values give the scale.
- Names around the rose thin out instead of colliding, and every wedge is in the table view, so nothing depends on reading a crowded label.
- Forced colors outline every wedge in CanvasText; reduced motion draws the rose in place.
All exports on this page
PolarAreaChart— Nightingale's rose: one wedge per category around a circle (months, hours, compass points), each wedge's area proportional to its value.PolarAreaTable— One row per wedge, one column per series, plus the total when there are several.defaultPolarAreaChartLabels— The built-in English strings of PolarAreaChart; spread it into your own labels and change what you need.foldPolarSeries— More than 8 series: the first 7 keep their slots and the rest are summed into one "Other" series (neutral grey), so colour slots never repeat.polarAreaLegend— Legend for a rose: one swatch per series (skip it for a single series: the title names it).
When to use the polar area chart
- Use it as a Nightingale rose (coxcomb) chart for cyclical categories such as months, hours of the day or compass points, where wedge position carries meaning and a circle makes the cycle obvious.
- It recreates Nightingale's rose: several series, such as causes of mortality per month, stack outward while each wedge's area stays proportional to its value.
- It suits a 24-hour traffic profile with one series and one hue, where wedge position and name identify the hour and labels thin out on narrow screens.
- Skip it when readers need to compare exact values across categories; a BarChart is easier to read, and RadarChart fits comparing profiles across several unrelated measures.
- Pair it with ChartCard for the title and Chart / Table tabs, PolarAreaTable for exact numbers, and polarAreaLegend when several series stack outward in the same wedge.
Frequently asked questions
Related pages
48 charts pages in all: browse them on Charts.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .