gkneighb opened a new pull request, #43571:
URL: https://github.com/apache/superset/pull/43571
### SUMMARY
Adds a `generate_chart` MCP plugin for the **radar** chart type (`viz_type:
radar`), so the MCP `generate_chart` tool can produce radar/spider charts.
Radar is a shipped Superset viz type that had no MCP plugin; this closes that
gap.
The plugin mirrors the frontend Radar `buildQuery` contract: multiple
`metrics` become the radar axes (indicators), and an optional `groupby` splits
the data into one polygon per category (with no groupby the whole dataset is a
single polygon). The query orders by the first metric descending.
Follows the established plugin pattern
(`pie`/`funnel`/`gauge`/`treemap`/`heatmap`/`waterfall`) — a config schema, a
`map_*_config` mapper, a plugin class, and registration:
- **`RadarChartConfig`** — a non-empty `metrics` list required (each metric
is one axis); optional `groupby` (series polygons), `row_limit` (default 10),
`filters`, `color_scheme`. Added to the `ChartConfig` discriminated union and
the `get_chart_type_schema` adapters. `groupby` entries may not be
`saved_metric`/`sql_expression` (dimensions, not metrics).
- **`map_radar_config`** — maps the config to `form_data`; each metric is
emitted as a metric object (saved metrics as bare name strings, ad-hoc metrics
as SIMPLE/SQL adhoc objects).
- **`RadarChartPlugin`** — registered in the plugin registry. `radar` was
absent from the recommendation category map, so this adds it (its own `radar`
category, consistent with how funnel/gauge/waterfall each carry a distinct
category).
The field set is intentionally minimal (core query contract). Cosmetic
controls (per-metric min/max bounds via `column_config`, label type/position,
circular vs polygon shape) are left for a follow-up.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend/MCP only, no UI change.
### TESTING INSTRUCTIONS
`pytest tests/unit_tests/mcp_service/chart/test_radar_chart.py` — 17 unit
tests cover schema validation (non-empty `metrics`, `groupby` optional and
not-a-metric, saved-metric axis accepted, extra-field rejection), `ChartConfig`
union dispatch, `form_data` mapping (multi-metric labels, series groupby,
filters, saved-metric passthrough), and registry integration (registration,
`resolve_viz_type`, `display_name`, `pre_validate`, recommendation category).
To exercise end-to-end: call the `generate_chart` MCP tool with
`{"chart_type": "radar", "metrics": [{"name": "speed", "aggregate": "AVG"},
{"name": "power", "aggregate": "AVG"}, {"name": "range", "aggregate": "AVG"}]}`.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]