本文へ移動
日本語
「レーダーチャート」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

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.

向いている場面

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

向かない場面

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

使い方

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}
    />
  )
}

プロパティ

プロパティ型既定値説明
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.

アクセシビリティ

  • 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.

モーション

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.

プロジェクトに追加

Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。

RadarChart.jsxradar-chart.csstokens.cssREADME.md

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

グラフ
「三辺測位」は Pro に含まれます。解除するとプレビューが表示されます。