Skip to content

Radar Diagram (v11.6.0+)

Introduction

A radar diagram is a simple way to plot low-dimensional data in a circular format.

It is also known as a radar chart, spider chart, star chart, cobweb chart, polar chart, or Kiviat diagram.

Usage

This diagram type is particularly useful for developers, data scientists, and engineers who require a clear and concise way to represent data in a circular format.

It is commonly used to graphically summarize and compare the performance of multiple entities across multiple dimensions.

Syntax

md
radar-beta
axis A, B, C, D, E
curve c1{1,2,3,4,5}
curve c2{5,4,3,2,1}
... More Fields ...

Examples

Code:
mermaid
Ctrl + Enter|
Code:
mermaid
Ctrl + Enter|

Details of Syntax

Title

title: The title is an optional field that allows to render a title at the top of the radar diagram.

radar-beta
  title Title of the Radar Diagram
  ...

Axis

axis: The axis keyword is used to define the axes of the radar diagram.

Each axis is represented by an ID and an optional label.

Multiple axes can be defined in a single line.

radar-beta
  axis id1["Label1"]
  axis id2["Label2"], id3["Label3"]
  ...

Curve

curve: The curve keyword is used to define the data points for a curve in the radar diagram.

Each curve is represented by an ID, an optional label, and a list of values.

Values can be defined by a list of numbers or a list of key-value pairs. If key-value pairs are used, the key represents the axis ID and the value represents the data point. Else, the data points are assumed to be in the order of the axes defined.

Multiple curves can be defined in a single line.

radar-beta
  axis axis1, axis2, axis3
  curve id1["Label1"]{1, 2, 3}
  curve id2["Label2"]{4, 5, 6}, id3{7, 8, 9}
  curve id4{ axis3: 30, axis1: 20, axis2: 10 }
  ...

Options

  • showLegend: The showLegend keyword is used to show or hide the legend in the radar diagram. The legend is shown by default.
  • max: The maximum value for the radar diagram. This is used to scale the radar diagram. If not provided, the maximum value is calculated from the data points.
  • min: The minimum value for the radar diagram. This is used to scale the radar diagram. If not provided, the minimum value is 0.
  • graticule: The graticule keyword is used to define the type of graticule to be rendered in the radar diagram. The graticule can be circle or polygon. If not provided, the default graticule is circle.
  • ticks: The ticks keyword is used to define the number of ticks on the graticule. It is the number of concentric circles or polygons drawn to indicate the scale of the radar diagram. If not provided, the default number of ticks is 5.
radar-beta
  ...
  showLegend true
  max 100
  min 0
  graticule circle
  ticks 5
  ...

Configuration

Please refer to the configuration guide for details.

ParameterDescriptionDefault Value
widthWidth of the radar diagram600
heightHeight of the radar diagram600
marginTopTop margin of the radar diagram50
marginBottomBottom margin of the radar diagram50
marginLeftLeft margin of the radar diagram50
marginRightRight margin of the radar diagram50
axisScaleFactorScale factor for the axis1
axisLabelFactorFactor to adjust the axis label position1.05
curveTensionTension for the rounded curves0.17

Theme Variables

Global Theme Variables

INFO

The default values for these variables depend on the theme used. To override the default values, set the desired values in the themeVariables section of the configuration: %%{init: {"themeVariables": {"cScale0": "#FF0000", "cScale1": "#00FF00"}} }%%

Radar charts support the color scales cScale${i} where i is a number from 0 to the theme's maximum number of colors in its color scale. Usually, the maximum number of colors is 12.

PropertyDescription
fontSizeFont size of the title
titleColorColor of the title
cScale$Color scale for the i-th curve

Radar Style Options

INFO

Specific variables for radar resides inside the radar key. To set the radar style options, use this syntax. %%{init: {"themeVariables": {"radar": {"axisColor": "#FF0000"}} } }%%

PropertyDescriptionDefault Value
axisColorColor of the axis linesblack
axisStrokeWidthWidth of the axis lines1
axisLabelFontSizeFont size of the axis labels12px
curveOpacityOpacity of the curves0.7
curveStrokeWidthWidth of the curves2
graticuleColorColor of the graticuleblack
graticuleOpacityOpacity of the graticule0.5
graticuleStrokeWidthWidth of the graticule1
legendBoxSizeSize of the legend box10
legendFontSizeFont size of the legend14px

Example on config and theme

Code:
mermaid
Ctrl + Enter|