mirror of
https://github.com/apache/superset.git
synced 2026-05-30 04:39:20 +00:00
Four UX bugs reported on the new country map chart:
1. **"Country: cannot be empty" stuck on the Data tab even at Admin 0.**
The Country control had a hard `validators: [validateNonEmpty]`, but
it's only rendered (and only meaningful) when admin_level != 0 and no
composite is set. The validator was firing for the hidden empty value
and trapped the user — the Update Chart button was permanently
disabled with no visible control to satisfy. Switched to a dynamic
validator via mapStateToProps so it only fires when the field is
actually needed.
2. **"Aggregated regions" threw TypeError: t.map is not a function.**
The region_set control used `choices: ({ controls }) => ...`, but
SelectControl's `choices` must be a literal array. Moved the
country-dependent choice computation into `mapStateToProps` (same
pattern other plugins use).
3. **Composite map always visible and "sticky" overriding admin_level.**
At Admin 0 (world choropleth) the composite override produced a map
that didn't change when you toggled admin_level. Hidden composite
control at Admin 0 entirely, and hidden it whenever the build
pipeline didn't emit any composites — leaves room for future
per-country scoping (e.g. only show france_overseas when country=FRA).
4. **Show flying islands checkbox was a no-op.** The build pipeline
doesn't currently tag features as flying, so the runtime drop logic
had nothing to act on. Removed from the control set rather than ship
a misleading control; a single line brings it back once the build
tags features.
Tests updated to cover all four behaviors.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@superset-ui/plugin-chart-country-map
Modern country/region choropleth chart for Apache Superset. Replaces
legacy-plugin-chart-country-map.
Status
🚧 Work in progress — see SIP_DRAFT.md in this directory for the full design rationale and implementation phases. This plugin lives in the same PR as the build pipeline that produces its data; both are currently scaffolded and being progressively fleshed out.
What it offers vs. the legacy plugin
| Legacy | New | |
|---|---|---|
| Backend endpoint | explore_json |
chart/data (modern) |
| Disputed-region handling | Hardcoded NE editorial | Configurable per-deployment + per-chart worldview (NE _ukr default) |
| Subdivisions level | Country-only | Country (Admin 0) and Subdivisions (Admin 1) and Aggregated regions |
| Data pipeline | Jupyter notebook | Reproducible script + YAML configs (see scripts/) |
| Per-deployment customization | Fork required | superset_config.COUNTRY_MAP block + chart-level controls |
| Composite maps (e.g. France-with-Overseas) | Hardcoded in notebook | Declarative in composite_maps.yaml |
| Regional aggregations (NUTS-1 etc.) | Hardcoded | Declarative in regional_aggregations.yaml |
Layout
src/
index.ts — package entry; exports CountryMapChartPlugin and types
types.ts — TypeScript types for form data + transform props
CountryMap.tsx — React component; renders the SVG chart
plugin/
index.ts — ChartPlugin class with metadata
buildQuery.ts — modern chart/data query builder
controlPanel.tsx— form controls (worldview, admin level, country, ...)
transformProps.ts — form_data → renderer props
scripts/ — build pipeline (NE shapefile → simplified GeoJSON outputs)
SIP_DRAFT.md — design draft for the eventual SIP issue
See also
SIP_DRAFT.md— design rationale, audit of legacy notebook, obsolescence findings, open questionsscripts/README.md— build pipeline operating principlesscripts/config/*.yaml— declarative transform configs (5 schemas for the 5 transform categories)scripts/procedural/README.md— escape hatch for edge cases YAML can't express