Ir al contenido
Español
Gráfico de radar viene con Pro. La vista previa aparece al desbloquearlo.

Cómo funciona

Rings are polygons rather than circles, so the grid has the same shape as the data, and the outer ring carries a barely visible fill that frames the plot. Each series is an SVG group that scales out of the centre on a spring while its outline draws in through pathLength; the second series follows 140ms later and vertex dots pop in last, one axis at a time. Axis names are HTML positioned around the plot and anchored by side, so long names wrap toward the outside instead of colliding with the chart. Pointing at a sector or using the arrow keys lights that spoke with a dashed line, fills its dots and shows each series' value as a chip in the series colour under the name. The radius follows the measured width.

Úsalo para

  • Comparing two profiles across the same five to eight qualities: two periods, two options, a target against actual.

Busca otra opción cuando

  • Precise comparison of values, or axes with different units: use a grouped bar chart.
  • More than three series: the shapes hide each other.

Uso

import { RadarChart } from './RadarChart.jsx'

export function TeamHealth({ current, previous }) {
  return (
    <RadarChart
      label="Team health survey, Q4 against Q3"
      axes={['Delivery', 'Quality', 'Focus time', 'Collaboration', 'Wellbeing', 'Learning']}
      series={[
        { name: 'Q4', values: current },
        { name: 'Q3', tone: 4, values: previous },
      ]}
      max={10}
    />
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
axesstring[]—Axis names, clockwise from 12 o'clock. Three to ten work best.
series{ name: string, values: number[], tone?: 1-8, color?: string, note?: ReactNode }[]—One value per axis. The first series is drawn first and sits underneath. note appears in the legend chip (an average, a date).
max / levelsnumberlargest value / 4The value at the outer ring, and the number of rings.
sizenumber300Largest chart diameter in px plus labels; it shrinks to fit narrow containers.
fill / dotsbooleantrueA translucent fill under each outline, and a dot at each vertex.
formatValue / label / labels(v) => string / string / { show(n), hide(n), axis(name, parts) }—Value format, the start of the accessible name, and legend and announcement wording.

Accesibilidad

  • The plot is one focusable image whose accessible name lists every axis with each series' value.
  • Arrow keys move between axes and a polite live region announces the axis and its values; Escape clears.
  • Legend buttons are toggle buttons with aria-pressed; a hidden series also turns its swatch into an outline.
  • Values are shown as text chips, never by colour alone.
  • Reduced motion shows the shapes at once.

Movimiento

Shapes: 760ms spring scale from the centre, outlines draw over 1000ms on the reveal curve, 140ms between series. Dots: 360ms spring pop from 560ms, 30ms per axis.

Añádelo a tu proyecto

Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.

RadarChart.jsxradar-chart.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Gráficos
Trilateración viene con Pro. La vista previa aparece al desbloquearlo.