Radar

A radar chart is a way of showing multiple data points and the variation between them.

They are often useful for comparing the points of two or more different data sets.

Example Usage

  1. var myRadarChart = new Chart(ctx, {
  2. type: 'radar',
  3. data: data,
  4. options: options
  5. });

Dataset Properties

The radar chart allows a number of properties to be specified for each dataset. These are used to set display properties for a specific dataset. For example, the colour of a line is generally set this way.

NameTypeScriptableIndexableDefault
backgroundColorColor--'rgba(0, 0, 0, 0.1)'
borderCapStylestring--'butt'
borderColorColor--'rgba(0, 0, 0, 0.1)'
borderDashnumber[]--[]
borderDashOffsetnumber--0.0
borderJoinStylestring--'miter'
borderWidthnumber--3
fillboolean|string--true
labelstring--''
lineTensionnumber--0.4
pointBackgroundColorColorYesYes'rgba(0, 0, 0, 0.1)'
pointBorderColorColorYesYes'rgba(0, 0, 0, 0.1)'
pointBorderWidthnumberYesYes1
pointHitRadiusnumberYesYes1
pointHoverBackgroundColorColorYesYesundefined
pointHoverBorderColorColorYesYesundefined
pointHoverBorderWidthnumberYesYes1
pointHoverRadiusnumberYesYes4
pointRadiusnumberYesYes3
pointRotationnumberYesYes0
pointStylestring|ImageYesYes'circle'

General

NameDescription
labelThe label for the dataset which appears in the legend and tooltips.

Point Styling

The style of each point can be controlled with the following properties:

NameDescription
pointBackgroundColorThe fill color for points.
pointBorderColorThe border color for points.
pointBorderWidthThe width of the point border in pixels.
pointHitRadiusThe pixel size of the non-displayed point that reacts to mouse events.
pointRadiusThe radius of the point shape. If set to 0, the point is not rendered.
pointRotationThe rotation of the point in degrees.
pointStyleStyle of the point. more…

All these values, if undefined, fallback first to the dataset options then to the associated elements.point.* options.

Line Styling

The style of the line can be controlled with the following properties:

NameDescription
backgroundColorThe line fill color.
borderCapStyleCap style of the line. See MDN.
borderColorThe line color.
borderDashLength and spacing of dashes. See MDN.
borderDashOffsetOffset for line dashes. See MDN.
borderJoinStyleLine joint style. See MDN.
borderWidthThe line width (in pixels).
fillHow to fill the area under the line. See area charts.
lineTensionBezier curve tension of the line. Set to 0 to draw straightlines.

All these values, if undefined, fallback to the associated elements.line.* options.

Interactions

The interaction with each point can be controlled with the following properties:

NameDescription
pointHoverBackgroundColorPoint background color when hovered.
pointHoverBorderColorPoint border color when hovered.
pointHoverBorderWidthBorder width of point when hovered.
pointHoverRadiusThe radius of the point when hovered.

Configuration Options

Unlike other charts, the radar chart has no chart specific options.

Scale Options

The radar chart supports only a single scale. The options for this scale are defined in the scale property.

  1. options = {
  2. scale: {
  3. // Hides the scale
  4. display: false
  5. }
  6. };

Default Options

It is common to want to apply a configuration setting to all created radar charts. The global radar chart settings are stored in Chart.defaults.radar. Changing the global options only affects charts created after the change. Existing charts are not changed.

Data Structure

The data property of a dataset for a radar chart is specified as an array of numbers. Each point in the data array corresponds to the label at the same index.

  1. data: [20, 10]

For a radar chart, to provide context of what each point means, we include an array of strings that show around each point in the chart.

  1. data: {
  2. labels: ['Running', 'Swimming', 'Eating', 'Cycling'],
  3. datasets: [{
  4. data: [20, 10, 4, 2]
  5. }]
  6. }