Skip to content
Radar

Radar

A radar/spider chart.

Radar

Usage

from dataviz_mojo import radar
from dataviz_mojo.plot import save

def main() raises:
    var indicators: List[String] = ["Attack", "Defense", "Speed", "Stamina", "Skill"]
    var max_values: List[Float64] = [100.0, 100.0, 100.0, 100.0, 100.0]
    var series_names: List[String] = ["Team A", "Team B"]
    var series_values: List[List[Float64]] = [
        [90.0, 60.0, 80.0, 70.0, 85.0],
        [65.0, 85.0, 55.0, 90.0, 60.0],
    ]

    var c = radar(indicators, max_values, series_names, series_values)
    save(c, "docs/src/examples/out_radar.svg")

Args:

  • indicators: One spoke per entry, in the given order.
  • max_values: Each spoke’s own independent maximum, paired with indicators[i].
  • series_names: One polygon per name, used as the legend key.
  • series_values: series_values[j] is series_names[j]’s value per indicator.
  • theme: Full styling knobs beyond this function’s own parameters (colors, margins, fonts, gridlines, …) – see Theme’s docstring.
  • width: Pixel width of the returned Plot (.size()).
  • height: Pixel height of the returned Plot (.size()).
  • title: The chart’s title, shown above the plot.
  • subtitle: A secondary line shown under the title.
  • x_title: The x-axis caption.
  • y_title: The y-axis caption.