Radar chart
Polar web comparing profiles across shared measures with spring-morphed shapes, gliding vertex markers, and an unobstructed axis tooltip.
import { RadarChart } from '@uthereal/ui/radar-chart'Radar chart playground
Office locations. Lisbon: Talent pool 78, Affordability 72, Transit 81, Quality of life 92, Tax climate 68. Zurich: Talent pool 94, Affordability 36, Transit 96, Quality of life 89, Tax climate 82.
| Measure | Lisbon | Zurich |
|---|---|---|
| Talent pool | 78 | 94 |
| Affordability | 72 | 36 |
| Transit | 81 | 96 |
| Quality of life | 92 | 89 |
| Tax climate | 68 | 82 |
Overview
A radar chart plots one to six profiles on concentric polygons across three to twelve shared measures. Profiles render by slot position, so replacing a profile at an existing slot morphs its polygon shape in place instead of swapping it abruptly. Moving a pointer or dragging across the web selects the nearest axis, glides vertex markers along each profile, and places a clamped tooltip past the axis label so every vertex stays visible. Hovering or pressing a legend key highlights that profile while dimming the rest. A native data table lists every measure and profile.
Use a radar chart to compare the overall shape, strengths, and gaps of two or three options—such as plans, office locations, products, or candidates—across five to eight measures that all point the same direction (higher is better). For exact differences on a single measure, use a bar chart. For before-and-after changes across two points, use a slope chart. For part-to-whole shares, use a donut chart.
Usage
import { useState } from 'react'
import { RadarChart, type RadarSeries } from '@uthereal/ui/radar-chart'
const axes = [
{ key: 'talent', label: 'Talent pool' },
{ key: 'afford', label: 'Affordability' },
{ key: 'transit', label: 'Transit' },
{ key: 'life', label: 'Quality of life' },
{ key: 'tax', label: 'Tax climate' },
]
const lisbon: RadarSeries = {
key: 'lisbon',
label: 'Lisbon',
values: { talent: 78, afford: 72, transit: 81, life: 92, tax: 68 },
}
const rivals: Record<string, RadarSeries> = {
zurich: {
key: 'zurich',
label: 'Zurich',
values: { talent: 94, afford: 36, transit: 96, life: 89, tax: 82 },
},
austin: {
key: 'austin',
label: 'Austin',
values: { talent: 88, afford: 64, transit: 49, life: 79, tax: 91 },
},
}
export function OfficeComparison() {
const [rival, setRival] = useState<'zurich' | 'austin'>('zurich')
const [axis, setAxis] = useState<string | null>(null)
return (
<RadarChart
label="Office locations"
axes={axes}
series={[lisbon, rivals[rival]]}
activeAxis={axis}
onActiveAxisChange={setAxis}
/>
)
}Place the primary subject in slot 0 so it takes the accent-derived --ui-series-1 color, and swap profiles in later slots to morph their polygon shapes smoothly. Pass activeAxis and onActiveAxisChange to synchronize axis inspection with sibling views, or pass formatValue for axis-specific formatting.
Examples
Per-axis scales and data table
Set max on individual axes when measures use different scales, adjust rings for guide density, append a unit suffix, and enable tableToggle to reveal the comparison table on demand.
Runtime benchmark. Edge v2: Throughput 890 pts, Cold start 176 pts, Memory efficiency 88 pts, Uptime 99 pts, Tooling 8.6 pts. Node LTS: Throughput 740 pts, Cold start 132 pts, Memory efficiency 71 pts, Uptime 98 pts, Tooling 9.4 pts.
| Measure | Edge v2 | Node LTS |
|---|---|---|
| Throughput | 890 pts | 740 pts |
| Cold start | 176 pts | 132 pts |
| Memory efficiency | 88 pts | 71 pts |
| Uptime | 99 pts | 98 pts |
| Tooling | 8.6 pts | 9.4 pts |
Behavior
| Condition or width | Layout and interaction behavior |
|---|---|
Slot 0 vs 1–5 | Slot 0 uses --ui-series-1 at 0.12 fill opacity; slots 1–5 use --ui-series-2–--ui-series-6 at 0.06 |
| Profile swap at slot | Interpolates every axis share from its live position to the new profile instead of unmounting the polygon |
| Tooltip placement | Sits past the active axis label (beside top/bottom axes, above/below side axes) and clamps inside the stage |
Width < 360 px | Shrinks the web diameter to fit the container and tightens outer label room from 64 px to 46 px with line wraps |
| All values zero | Renders emptyLabel ("No data") centered in the stage and hides the legend |
The tooltip sorts profiles descending on the active axis and prints each trailing profile's gap from the leader with a minus sign (−). Touch presses capture the pointer and scrub axes smoothly on drag without blocking vertical scroll.
API reference
These serializable arguments and defaults come directly from the component schema.
| Argument | Type / default | Description |
|---|---|---|
label | stringDefault: "Radar chart" | Names the chart for assistive technology and captions the data table when title is omitted. |
title | string— | Optional visible figure heading above the web. Omit it to render without a visible heading while keeping label for assistive technology. |
description | string— | One or two sentences on what the chart shows, below the title; omit it when the title says enough. |
axes | RadarAxis[]Default: [{"key":"talent","label":"Talent pool"},{"key":"afford","label":"Affordability"},{"key":"transit","label":"Transit"},{"key":"life","label":"Quality of life"},{"key":"tax","label":"Tax climate"}] | Shared measures around the web clockwise from the top (3–12, unique keys). Each axis takes key, label, and an optional per-axis max. |
series | RadarSeries[]Default: [{"key":"lisbon","label":"Lisbon","values":{"talent":78,"afford":72,"transit":81,"life":92,"tax":68}},{"key":"zurich","label":"Zurich","values":{"talent":94,"afford":36,"transit":96,"life":89,"tax":82}}] | Profiles compared on the web (1–6, unique keys; two or three read best). Drawn by slot position so replacing a profile at a slot morphs its polygon smoothly. |
max | numberDefault: 100 | Default top value of every axis unless overridden by axis.max. |
rings | integerDefault: 4 | Number of concentric guide polygons drawn behind the shapes (2–8). |
size | integerDefault: 320 | Largest web diameter in pixels (180–600). Shrinks automatically to fit narrow containers. |
legend | booleanDefault: true | Show profile names with a line key below the web. Hovering previews and pressing pins a profile forward while dimming others. |
unit | string— | Optional unit suffix appended after formatted values in tooltips, live announcements, and the data table. |
valueFormat | NumberFormat— | Intl number format for values. Omit it to display grouped numbers with up to one decimal place. |
emptyLabel | stringDefault: "No data" | Shown over the stage when there are fewer than three axes, no series, or all values are zero. |
tableToggle | booleanDefault: false | Show a button that reveals the data table. The table is always available to assistive technology. |
tableLabel | stringDefault: "Data table" | Name of the data table button. |
locale | string— | BCP 47 locale for numbers and dates. Omit it to inherit the application locale (en-US by default). |
recipe | studio | softDefault: "studio" | Visual treatment. Both recipes use the same interaction behavior. |
theme | RadarChartTheme— | Color mode, accent, and semantic tokens including the chart series palette (series1–series6 tint profile slots in order). See Theming. |
motion | none | subtle | expressiveDefault: "subtle" | Unfold, shape morph, vertex marker, tooltip, and legend layout animation preset. System reduced-motion preferences take precedence. |
motionOptions | RadarChartMotionOptions— | draw (initial center-out unfold at 35% in view; 900 ms zero-bounce spring by default) and morph (profile swap and data transitions; 600 ms spring by default): a tween with duration (ms) or a spring. |
dir | ltr | rtl— | Reading direction for figure layout, tooltips, legend, and the data table. Omit to inherit the page direction. |
React integration
| Prop | Purpose |
|---|---|
activeAxis | Controlled axis key in focus, or null for none |
onActiveAxisChange | Fires with the active axis key or null as focus moves, in both modes |
formatValue | Custom formatter (value: number, axis: RadarAxis) => string for tooltip and table |
preset | Application defaults, overridden by explicit instance props |
tokens | CSS variables applied after the typed theme |
ref | Ref forwarded to the root <figure> |
className, style | Applied to the root <figure> |
| Native attributes | id, data-*, and remaining <figure> attributes forwarded to the root |
Keyboard & accessibility
| Key | Interaction |
|---|---|
Tab | Focus the web (reading the first axis), then legend profile keys |
ArrowRight, ArrowDown | Move to the next axis clockwise |
ArrowLeft, ArrowUp | Move to the previous axis counter-clockwise |
Home, End | Jump to the first or last axis |
Escape | Clear the active axis reading and hide the tooltip |
Enter, Space | Pin or unpin the focused legend profile (aria-pressed) |
The chart renders a <figure> named by title (or visually hidden label when title is omitted) and linked via aria-details to a native data table with one row per measure and one column per profile. SVG rings, spokes, polygons, vertex markers, axis labels, and the visual tooltip are hidden from assistive technology.
The web forms a single focusable group (aria-roledescription="radar chart"). Moving across axes updates a polite role="status" live region with the axis label and every profile's formatted value, paired with a visually hidden summary of all measures. Profiles always appear with named line keys in the legend and tooltip so identity never depends on color alone. Logical CSS properties preserve alignment in dir="rtl", and forced-colors: active maps rings, polygons, markers, tooltips, and pressed legend keys to system colors.
Motion and theming
When 35% of the figure enters the viewport, the web fades in and polygons unfold from the center on a 900 ms zero-bounce spring (motionOptions.draw); server-rendered markup is already final. Swapping a profile or updating values morphs every polygon directly on its SVG path using a 600 ms spring (motionOptions.morph, bounce 0.16) without re-rendering React per frame. Vertex markers and the tooltip glide between axes on a responsive spring, and legend buttons reflow smoothly when profile names change width. Under prefers-reduced-motion: reduce and motion="none", shapes swap immediately, markers and tooltips snap without springs, and CSS transitions and press scale turn off.
theme accepts a mode, an accent, and semantic tokens across the core, control, and chart token groups (series1–series6 tint profile slots in order). An application-wide UtherealProvider supplies defaults.
Composition
In an agent composition, RadarChart is a leaf with no actions. onActiveAxisChange is a transient UI event bound to activeAxis. The host updates axes and series through composition updates. See Building with agents.
{
"type": "RadarChart",
"props": {
"label": "Office locations",
"axes": [
{ "key": "talent", "label": "Talent pool" },
{ "key": "afford", "label": "Affordability" },
{ "key": "transit", "label": "Transit" },
{ "key": "life", "label": "Quality of life" },
{ "key": "tax", "label": "Tax climate" }
],
"series": [
{
"key": "lisbon",
"label": "Lisbon",
"values": {
"talent": 78,
"afford": 72,
"transit": 81,
"life": 92,
"tax": 68
}
},
{
"key": "zurich",
"label": "Zurich",
"values": {
"talent": 94,
"afford": 36,
"transit": 96,
"life": 89,
"tax": 82
}
}
]
},
"children": []
}