RadarChart
Radar charts comparing series across categories, one spoke per category.
stable
Quick Preview
Listing scorecard
Ikate duplex · scored 0–100
Usage
import { RadarChart } from "@giddaa-housing/ui/radar-chart";
<RadarChart
data={[
{ criterion: "Location", lekki: 86, yaba: 72 },
{ criterion: "Price", lekki: 58, yaba: 81 },
{ criterion: "Amenities", lekki: 90, yaba: 64 },
]}
categoryKey="criterion"
series={[
{ key: "lekki", label: "Lekki" },
{ key: "yaba", label: "Yaba" },
]}
ariaLabel="Neighbourhood scores by criterion"
/>RadarChart takes the same data, categoryKey, and series as
BarChart, with one spoke per category, clockwise from
twelve o'clock. A missing value makes that series' polygon skip the spoke.
Examples
Single series
Listing scorecard
Ikate duplex · scored 0–100
Multiple series
Each series gets its own palette slot and a legend entry.
Neighbourhood comparison
Average listing scores · 0–100
Circular grid, value scale, no dots
gridShape="circle", spokes={false}, valueAxis, a fixed valueDomain,
points={false}, and a stronger fillOpacity.
Customized radar
Circular grid, visible value scale, no dots
Props
| Prop/API | Type | Default | Description |
|---|---|---|---|
data | readonly T[] | required | One row per spoke. |
categoryKey | string or number field of T | required | Field naming each spoke, in angular order. |
series | { key, label?, color? }[] | required | key names a numeric field. |
ariaLabel | string | required | Accessible chart name. |
size | "sm" | "md" | "lg" | inherited, otherwise "md" | Plot height and type (RADAR_CHART_LAYOUT). |
legend | boolean | { align?, placement? } | shown for 2+ series | Series legend; items toggle their series. |
tooltip | boolean | true | Hover and keyboard tooltip. |
grid | boolean | true | Concentric rings at the value ticks. |
gridShape | "polygon" | "circle" | "polygon" | Ring shape. |
spokes | boolean | true | Lines from the center to each category. |
valueAxis | boolean | false | Value ticks along the right-hand ray. |
valueDomain | [number, number] | fitted from zero | Fixed value extent. |
valueTicks | number[] | five rounded ticks | Exact ticks, which also place the rings. |
points | boolean | true | Resting dot at every observation. |
fillOpacity | number | 0.15 | Opacity of each series' wash. |
formatValue | (value: number) => string | grouped number | Value ticks and tooltip values. |
formatCategory | (value: string | number) => string | String | Spoke labels and tooltip titles. |
emptyMessage | ReactNode | "No data to display" | Shown when no valid values exist. |
| Chart host props | see Chart | - | height, initialWidth, ariaDescription, tooltipFooter, renderTooltipBody, callbacks, className, style. |
createRadarChartDefinition(options) | function | - | Same options plus hiddenSeries; returns an extensible TanStack definition. |
RadarChartSeries, RadarChartOptions, RadarChartDatum, RadarChartDefinition | types | - | Exported for typed series and builders. |
Accessibility
- Provide a meaningful
ariaLabel; focus the chart and use arrow keys to move between observations. - Keep the legend whenever more than one series renders.
- Radar values are read comparatively; turn on
valueAxisor keep the tooltip when exact figures matter.