Radar Chart Strategy¶
radar_chart_strategy ¶
Radar Chart Strategy - Polar/Radar Chart Visualizations.
This module implements the RadarChartStrategy for generating radar/polar chart visualizations with flexible configuration.
Classes:
| Name | Description |
|---|---|
RadarChartStrategy | Strategy for radar chart generation. |
Notes
- Supports polar/radar chart visualization
- Data aggregation by category and group
- Unique value counting (e.g., unique KO counts)
- Radial axis auto-scaling with padding
For supported use cases, refer to the official documentation.
Classes¶
RadarChartStrategy ¶
Bases: BasePlotStrategy
Strategy for radar chart comparative multi-dimensional visualization.
This strategy creates polar/radar charts to compare entities across multiple categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | Dict[str, Any] | Complete configuration from YAML file. | required |
Attributes:
| Name | Type | Description |
|---|---|---|
data_config | Dict[str, Any] | Data processing configuration from YAML. |
plotly_config | Dict[str, Any] | Plotly-specific configuration from YAML. |
Methods:
| Name | Description |
|---|---|
validate_data | Validate input data for radar chart requirements |
process_data | Process and aggregate data for radar chart visualization |
create_figure | Create Plotly radar chart from processed data |
Notes
- Displays values radiating from center point
- Each spoke represents a different category
- Distance from center indicates magnitude
- Supports multiple aggregation methods (nunique, count, sum, mean)
Initialize strategy with configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | Dict[str, Any] | Complete configuration from YAML file. | required |
Source code in src/domain/plot_strategies/charts/radar_chart_strategy.py
Functions¶
validate_data ¶
Validate input data for radar chart requirements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | Input data to validate. | required |
Raises:
| Type | Description |
|---|---|
ValueError | If DataFrame is empty, required columns missing, or configuration invalid. |
Source code in src/domain/plot_strategies/charts/radar_chart_strategy.py
process_data ¶
Process and aggregate data for radar chart visualization.
Groups data by theta column and aggregates r column using specified method (nunique, count, sum, mean).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | Validated input data. | required |
Returns:
| Type | Description |
|---|---|
DataFrame | Processed data with columns: theta (category labels), r (aggregated values). |
Source code in src/domain/plot_strategies/charts/radar_chart_strategy.py
create_figure ¶
Create Plotly radar chart from processed data.
Creates polar/radar chart with auto-scaled radial axis and configurable styling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
processed_df | DataFrame | Processed data with columns: theta, r | required |
Returns:
| Type | Description |
|---|---|
Figure | Configured Plotly figure with radar chart. |
Source code in src/domain/plot_strategies/charts/radar_chart_strategy.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
apply_filters ¶
Apply filters to data.
This is a common implementation that can be overridden by subclasses if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | Data to filter. | required |
filters | Optional[Dict[str, Any]] | Filter specifications. | None |
Returns:
| Type | Description |
|---|---|
DataFrame | Filtered data. |
Source code in src/domain/plot_strategies/base/base_plot_strategy.py
apply_customizations ¶
Apply custom styling to figure.
This is a hook for future customization features (FLEXIVEL and FLEXIVEL2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fig | Figure | Base figure. | required |
customizations | Optional[Any] | Customization specifications. | None |
Returns:
| Type | Description |
|---|---|
Figure | Customized figure. |
Source code in src/domain/plot_strategies/base/base_plot_strategy.py
generate_plot ¶
generate_plot(data: DataFrame, filters: Optional[Dict[str, Any]] = None, customizations: Optional[Any] = None) -> go.Figure
Generate complete plot (Template Method).
This method orchestrates the entire plot generation process: 1. Validate input data 2. Process data 3. Apply filters 4. Create figure 5. Apply customizations
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | DataFrame | Input data. | required |
filters | Optional[Dict[str, Any]] | Filters to apply. | None |
customizations | Optional[Any] | Customizations to apply. | None |
Returns:
| Type | Description |
|---|---|
Figure | Complete Plotly figure. |
Raises:
| Type | Description |
|---|---|
ValueError | If validation fails. |