Radar Chart

Documentation Index

Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.

Radar charts with filled and lines variants and gradient colors, powered by Apache ECharts

Basic Chart

Installation

npx shadcn@latest add @evilcharts/echarts-radar-chart

Usage

The ECharts radar chart is composible, sharing the Recharts twin's API shape. <EChartsRadarChart> is the container, and every part hangs off it as a compound member — <EChartsRadarChart.PolarGrid>, <EChartsRadarChart.PolarAngleAxis>, <EChartsRadarChart.PolarRadiusAxis>, <EChartsRadarChart.Legend>, <EChartsRadarChart.Tooltip>, and one or more <EChartsRadarChart.Radar> — so a single import gives you the whole chart. Each <Radar> carries its own variant and isClickable, so one chart can mix fill styles and make only some series interactive.

import { EChartsRadarChart, type ChartConfig } from "@/components/evilcharts/charts/echarts-radar-chart";
const data = [
  { skill: "JavaScript", desktop: 186, mobile: 80 },
  { skill: "TypeScript", desktop: 305, mobile: 200 },
  { skill: "React", desktop: 237, mobile: 120 },
  { skill: "Node.js", desktop: 173, mobile: 190 },
  { skill: "CSS", desktop: 209, mobile: 130 },
];
 
const chartConfig = {
  desktop: {
    label: "Desktop",
    colors: { light: ["#3b82f6"], dark: ["#60a5fa"] },
  },
  mobile: {
    label: "Mobile",
    colors: { light: ["#10b981"], dark: ["#34d399"] },
  },
} satisfies ChartConfig;
 
<EChartsRadarChart data={data} config={chartConfig}>
  <EChartsRadarChart.PolarGrid />
  <EChartsRadarChart.PolarAngleAxis dataKey="skill" />
  <EChartsRadarChart.Legend />
  <EChartsRadarChart.Tooltip />
  <EChartsRadarChart.Radar dataKey="desktop" variant="filled">
    <EChartsRadarChart.Dot variant="colored-border" />
    <EChartsRadarChart.ActiveDot variant="default" />
  </EChartsRadarChart.Radar>
  <EChartsRadarChart.Radar dataKey="mobile" variant="filled" />
</EChartsRadarChart>

The one difference from the Recharts twin is under the hood: ECharts renders to a <canvas>, so these children never mount as DOM. The root reads their props and compiles them into the ECharts option — same JSX, same presence semantics (omit a part and it doesn't render), same behavior, only the children are declarative config rather than live DOM nodes.

The config is the same contract as every EvilCharts chart — each key maps a data key to a label and a per-theme colors array. See Chart Config for the full shape. Colors resolve from your CSS variables at runtime, so dark mode just works.

Interactive Selection

Set isClickable on a <Radar> to make it selectable by click, and on <Legend> to let entries toggle selection. React to changes with the root's onSelectionChange callback:

<EChartsRadarChart
  data={data}
  config={chartConfig}
  onSelectionChange={(selectedDataKey) => {
    if (selectedDataKey) {
      console.log("Selected:", selectedDataKey);
    } else {
      console.log("Deselected");
    }
  }}
>
  <EChartsRadarChart.PolarGrid />
  <EChartsRadarChart.PolarAngleAxis dataKey="skill" />
  <EChartsRadarChart.Legend isClickable />
  <EChartsRadarChart.Tooltip />
  <EChartsRadarChart.Radar dataKey="desktop" variant="filled" isClickable />
  <EChartsRadarChart.Radar dataKey="mobile" variant="filled" isClickable />
</EChartsRadarChart>

Loading State

isLoading='true'
<EChartsRadarChart data={[]} config={chartConfig} isLoading>
  <EChartsRadarChart.PolarGrid />
  <EChartsRadarChart.PolarAngleAxis dataKey="skill" />
  <EChartsRadarChart.Legend />
  <EChartsRadarChart.Tooltip />
  <EChartsRadarChart.Radar dataKey="desktop" variant="filled" />
  <EChartsRadarChart.Radar dataKey="mobile" variant="filled" />
</EChartsRadarChart>

Examples

Radar charts with different configurations.

Lines Variant

variant='lines'

Circle Grid

gridType='circle'

Gradient Colors

gradient colors

API Reference

The radar chart is a root container plus composible parts. On canvas each part is declarative config the root compiles, but the API mirrors the Recharts twin. Each is documented below.

EChartsRadarChart

The root container. It owns the data, shared selection state, loading skeleton, and intro reveal. Everything visual is composed as children and compiled into the ECharts option.

PropTypeDefaultDescription
data*TData[]

The chart data — an array of objects, one per angle-axis category (TData extends Record<string, unknown>).

config*ChartConfig

Defines the radar series. Each key matches a numeric data key, with a label and a per-theme colors array. Same contract as every EvilCharts chart — see Chart Config.

children*ReactNode

The composed chart parts — <PolarGrid />, <PolarAngleAxis />, <PolarRadiusAxis />, <Legend />, <Tooltip />, and one or more <Radar />.

classNamestring

Additional CSS classes for the chart container.

animationbooleantrue

Master switch for the intro draw-in — the radar polygon grows from the center on first render. Pass false to render instantly. The OS reduce-motion preference disables it automatically.

defaultSelectedDataKeystring | nullnull

The radar series selected on first render.

onSelectionChange(key: string | null) => void

Fires when a series is selected or deselected via a clickable <Radar /> or <Legend />. Receives the selected data key, or null when deselected.

isLoadingbooleanfalse

Shows the animated loading skeleton while data loads.

loadingPointsnumber6

Number of points rendered in the loading skeleton polygon.

chartOptionsRecord<string, unknown>

Escape hatch merged over the underlying ECharts option object. See the ECharts option documentation.

Radar

A single radar series — one polygon across every angle-axis category. Each <Radar /> carries its own fill and clickability, so a chart can hold many radars styled independently. Compose <Dot /> and <ActiveDot /> inside for vertex markers.

PropTypeDefaultDescription
dataKey*string

The series key to render. Must exist on both the data rows and the chart config.

variantfilled|lines"filled"

The visual style for this radar. "filled" shows a filled area, "lines" shows only the outline.

fillOpacitynumber0.3

The opacity of the filled area when using variant="filled".

isClickablebooleanfalse

Lets this radar be clicked to select/deselect it. When one is selected, unselected clickable radars turn semi-transparent.

childrenReactNode

Optional <Dot /> and <ActiveDot /> composition for vertex markers on this radar.

Dot and ActiveDot

Vertex markers composed inside a <Radar />. <Dot /> is the resting marker; <ActiveDot /> is the hovered marker. They render nothing on their own — the parent <Radar /> reads their variant.

PropTypeDefaultDescription
variantdefault|border|colored-border"default"

The visual style of the vertex marker.

PolarGrid

The polar grid — the concentric rings and the radial spokes. Its presence draws the grid; omit it and no grid lines render.

PropTypeDefaultDescription
gridTypepolygon|circle"polygon"

The shape of the grid rings. "polygon" creates angular grid lines, "circle" creates circular grid lines.

PolarAngleAxis

The angular category axis — the labels around the chart's perimeter. Its presence shows the labels; omit it and they hide. Hidden automatically while the chart is loading.

PropTypeDefaultDescription
dataKeystring

The data key for the angle-axis labels (e.g. categories, skills, months). When omitted, the first data column not claimed by a <Radar /> is used.

PolarRadiusAxis

The radial value axis — the scale running from the center outward. Its presence shows the scale labels; omit it and they hide. Hidden automatically while the chart is loading. It takes no props.

Tooltip

The hover tooltip. Its presence enables the tooltip; omit it and none shows. On canvas the tooltip is item-triggered — it shows the hovered series and its value at each category, and dims its content when another series is selected.

PropTypeDefaultDescription
variantdefault|frosted-glass"default"

The visual style of the tooltip surface.

roundnesssm|md|lg|xl"lg"

Controls the border-radius of the tooltip.

positionfixed|variable"variable"

Anchoring of the tooltip. "variable" follows the pointer (default). "fixed" pins the tooltip near the top and only tracks the pointer's X.

defaultIndexnumber

Shows a tooltip by default with no hover. Because the radar tooltip is item-triggered, this selects the series (by index) whose tooltip is revealed.

Legend

The series legend, rendered as HTML above the canvas. Its presence enables the legend; omit it and none shows. When isClickable is set, each entry toggles selection of its series. Hidden automatically while the chart is loading.

PropTypeDefaultDescription
variantsquare|circle|circle-outline|rounded-square|rounded-square-outline|vertical-bar|horizontal-bar

The visual style of the legend indicators.

alignleft|center|right"center"

Horizontal placement of the legend.

verticalAligntop|middle|bottom"bottom"

Vertical placement of the legend.

isClickablebooleanfalse

Lets each legend entry toggle selection of its series, driving the shared selection state read by every <Radar />.