RadarChart

A radar chart control for Flet applications, displaying data across multiple axes.

Overview

  • Creates a multi-dataset radar chart.
  • Inherits from LayoutControl.
  • Properties

  • animation: Controls implicit animation on update. Type: AnimationValue.
  • border: Border around the chart. Type: Border | None.
  • center_min_value: Positions minimum entry values at the center. Type: bool (default: False).
  • data_sets: List of RadarDataSet controls. Type: list[RadarDataSet].
  • grid_border_side: Style of radar grid lines. Type: BorderSide (default: BorderSide(width=2.0)).
  • interactive: Enables touch interactions and events. Type: bool (default: True).
  • long_press_duration: Duration for long-press event. Type: DurationValue | None.
  • radar_bgcolor: Background color of the radar area. Type: ColorValue (default: Colors.TRANSPARENT).
  • radar_border_side: Outline of the radar area. Type: BorderSide (default: BorderSide(width=2.0)).
  • radar_shape: Shape of the radar area. Type: RadarShape (default: RadarShape.POLYGON).
  • tick_border_side: Style of tick rings. Type: BorderSide (default: BorderSide(width=2.0)).
  • tick_count: Number of tick rings. Type: Number (default: 1). Must be >= 1.
  • ticks_text_style: Text style for tick labels. Type: TextStyle | None.
  • title_position_percentage_offset: Relative distance of titles from center. Type: Number (default: 0.2). Must be between 0 and 1.
  • title_text_style: Text style for titles. Type: TextStyle | None.
  • titles: List of titles around the chart. Type: list[RadarChartTitle].
  • touch_spot_threshold: Radius for detecting nearby entries for touches. Type: Number (default: 10).
  • Events

  • on_event: Callback when the chart is interacted with. Type: EventHandler[RadarChartEvent] | None.
  • Example Usage

    import flet as ft
    import flet_charts as fch

    def main(page: ft.Page): page.title = "Radar chart" page.padding = 20 page.theme_mode = ft.ThemeMode.LIGHT

    categories = ["macOS", "Linux", "Windows"]

    page.add( fch.RadarChart( expand=True, titles=[fch.RadarChartTitle(text=label) for label in categories], center_min_value=True, tick_count=4, ticks_text_style=ft.TextStyle(size=20, color=ft.Colors.ON_SURFACE), title_text_style=ft.TextStyle( size=24, weight=ft.FontWeight.BOLD, color=ft.Colors.ON_SURFACE ), on_event=lambda e: print(e.type), data_sets=[ fch.RadarDataSet( fill_color=ft.Colors.with_opacity(0.2, ft.Colors.DEEP_PURPLE), border_color=ft.Colors.DEEP_PURPLE, entry_radius=4, entries=[ fch.RadarDataSetEntry(300), fch.RadarDataSetEntry(50), fch.RadarDataSetEntry(250), ], ), fch.RadarDataSet( fill_color=ft.Colors.with_opacity(0.15, ft.Colors.PINK), border_color=ft.Colors.PINK, entry_radius=4, entries=[ fch.RadarDataSetEntry(250), fch.RadarDataSetEntry(100), fch.RadarDataSetEntry(200), ], ), fch.RadarDataSet( fill_color=ft.Colors.with_opacity(0.12, ft.Colors.CYAN), border_color=ft.Colors.CYAN, entry_radius=4, entries=[ fch.RadarDataSetEntry(200), fch.RadarDataSetEntry(150), fch.RadarDataSetEntry(50), ], ), ], ) )

    if __name__ == "__main__": ft.run(main)