API Reference

Radar Chart API

Complete API reference for the Radar Chart, including data format, configuration options, custom parts, and context methods.

Data Format

Each dataset represents a radar polygon with a legend name and values for each axis label.

type RadarChartData = {
  labels: string[];
  datasets: { legend: string; values: number[] }[];
};
AG Style Config

Radar

PropertyTypeDefaultDescription
radar.fillOpacitynumber0.3Fill opacity of radar polygons (0 to 1).
radar.strokeWidthnumber2Stroke width of radar polygon outlines.
radar.gridColorstring"#e2e2e2"Color of the radial grid lines.
radar.gridWidthnumber1Width of radial grid lines.
radar.axisColorstring"#8a8c8c"Color of the angular axis lines.
radar.axisWidthnumber1Width of angular axis lines.
radar.labelMarginnumber20Margin around the radar plot area for axis labels.
Toast Style Config

Radar

PropertyTypeDefaultDescription
radar.fillOpacitynumber0.3Fill opacity of radar polygons (0 to 1).
radar.strokeWidthnumber2Stroke width of radar polygon outlines.
radar.gridColorstring"rgba(0, 0, 0, 0.1)"Color of the radial grid lines.
radar.gridWidthnumber1Width of radial grid lines.
radar.axisColorstring"rgba(0, 0, 0, 0.1)"Color of the angular axis lines.
radar.axisWidthnumber1Width of angular axis lines.
radar.labelMarginnumber5Margin around the radar plot area for axis labels.

Custom Parts

Override any visual element by providing a custom builder function: (args, context) => Widget

PartArgsDescription
layout{ title: Widget; legends: Widget[]; plot: Widget }Top-level layout composing title, legends, and the plot area.
plot{ dataView: Widget; tooltipArea: Widget; web: Widget; radialAxis: Widget; angularItems: AngularItem[] }The plot area with data view, web guides, radial axis, and angular labels.
radialAxis{ labels: RadialLabelItem[] }Radial axis with value labels at each ring level.
web{ angularLines: WebAngularGuide[]; radialLines: WebRadialGuide[] }The web/grid structure with angular and radial guide lines.
angularLine{ axisCount: number }Individual angular guide line from center to edge.
radialLineundefinedIndividual radial (ring) guide line.
angularAxisLabel{ index: number; label: string; angle: number }Label at the end of an angular axis.
radialAxisLabel{ value: number; index: number; ratio: number }Value label on a radial ring.
dataView{ radars: Widget[] }Container for all radar polygon widgets.
radar{ legend: string; index: number; vertices: RadarVertex[]; isHovered: boolean; hoveredPointIndex: number | null }Individual radar polygon for a series.
legend{ name: string; index: number; isVisible: boolean }Individual legend item.
titleundefinedChart title element.
tooltip{ label: string; items: { legend: string; color: string; value: number }[] }Tooltip content widget.
tooltipArea{ hoveredRadar: HoveredRadar | null; hoveredPoint: HoveredRadarPoint | null }Tooltip positioning area.

Context: RadarChartContext

Available in every custom builder via the second argument.

NameTypeKindDescription
dataRadarChartDatapropertyCurrent chart data (filtered by hidden series).
legendsstring[]propertyAll legend names from the raw data.
widthnumberpropertyCurrent chart width in pixels.
heightnumberpropertyCurrent chart height in pixels.
plotWidthnumberpropertyWidth of the plot area in pixels.
plotHeightnumberpropertyHeight of the plot area in pixels.
scaleRadarChartScale | nullpropertyComputed scale with min, max, and step.
hiddenSeriesReadonlySet<string>propertySet of currently hidden series.
hoveredRadar{ index: number; legend: string } | nullpropertyCurrently hovered radar polygon.
hoveredPoint{ index: number; legend: string; pointIndex: number } | nullpropertyCurrently hovered vertex point.
configTConfigpropertyThe resolved chart configuration object.
isSeriesVisible(legend)(legend: string) => booleanmethodCheck if a series is currently visible.
toggleSeries(legend)(legend: string) => voidmethodToggle visibility of a series.
showSeries(legend)(legend: string) => voidmethodShow a hidden series.
hideSeries(legend)(legend: string) => voidmethodHide a visible series.
showAllSeries()() => voidmethodShow all hidden series.
hoverRadar(index, legend)(index: number, legend: string) => voidmethodSet hover state on a radar polygon.
unhoverRadar(index, legend)(index: number, legend: string) => voidmethodClear hover on a radar polygon.
unhoverAllRadars()() => voidmethodClear all radar hover state.
isRadarHovered(index, legend)(index: number, legend: string) => booleanmethodCheck if a specific radar is hovered.
hoverPoint(index, legend, pointIndex)(index: number, legend: string, pointIndex: number) => voidmethodSet hover state on a vertex point.
unhoverPoint(index, legend, pointIndex)(index: number, legend: string, pointIndex: number) => voidmethodClear hover on a vertex point.
unhoverAllPoints()() => voidmethodClear all point hover state.
isPointHovered(index, legend, pointIndex)(index: number, legend: string, pointIndex: number) => booleanmethodCheck if a specific vertex point is hovered.
getRadarVertices(index, legend)(index: number, legend: string) => RadarVertex[] | nullmethodGet computed vertices for a radar polygon.
getRadarAnchorPosition(index, legend)(index: number, legend: string) => { x: number; y: number } | nullmethodGet anchor position for a radar polygon.
setSize(width, height)(width: number, height: number) => voidmethodUpdate chart dimensions.
setPlotSize(width, height)(width: number, height: number) => voidmethodUpdate plot area dimensions.

Custom Part Example

import { ToastRadarChart } from "@/components/flitter/charts/toast-radar-chart";

<ToastRadarChart
  data={data}
  config={{
    radar: { fillOpacity: 0.2, strokeWidth: 3 },
  }}
/>