RadarChart

A polygon per series over axes that start at the same center, to compare profiles. Use it to compare a few items across the same five to eight criteria.

Charts need Recharts. Install it once with yarn add recharts, then import from @bolio-ui/core/charts. The package stays out of your bundle until you use a chart.

General

Each row of data is one axis, named by dataKey. Each item of series is one polygon.

Radius axis and dots

withPolarRadiusAxis writes the scale, and withDots marks each value.

Clean

Turn the grid and the axis names off to leave only the shape.

APIs

RadarChart.Props

AttributeDescriptionTypeAccepted valuesDefault
dataone object per axisArray<Record<string, ...>>--
dataKeykey of data that names the axisstring--
seriesthe polygons to draw, one per key of dataChartSeries[]ChartSeries-
heightheight of the chart, in pixelsnumber-320
withLegendshow the legendboolean-false
withTooltipshow the values on hover and focusboolean-true
withPolarGriddraw the web behind the polygonsboolean-true
withPolarAngleAxiswrite the name of each axisboolean-true
withPolarRadiusAxiswrite the scale along one axisboolean-false
withDotsdraw a dot on each valueboolean-false
valueFormatterhow a value is written in the scale and the tooltip(value: number) => string--
...native props, passed to the rootHTMLAttributes'aria-label', 'className', ...-

ChartSeries

type ChartSeries = {
  name: string // key of `data` with the values
  label?: string // shown in the legend and the tooltip, `name` when missing
  color?: string // any CSS color, a theme color when missing
}

Ref

The ref points at the root div.

Accessibility

Name the chart with aria-label, or with aria-labelledby pointing at a heading. A named chart becomes a group.

A radar is hard to read without sight, so write the key values in text next to it, or offer the same data in a Table.

Edit this page on GitHub