Skip to content

Commit 97e6e47

Browse files
yong1lekshi020302
authored andcommitted
fix(dashboard): ensure world map chart uses correct country code format in crossfilter (apache#35919)
1 parent 1d7e455 commit 97e6e47

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const propTypes = {
3131
data: PropTypes.arrayOf(
3232
PropTypes.shape({
3333
country: PropTypes.string,
34+
code: PropTypes.string,
3435
latitude: PropTypes.number,
3536
longitude: PropTypes.number,
3637
name: PropTypes.string,
@@ -116,7 +117,7 @@ function WorldMap(element, props) {
116117
const selected = Object.values(filterState.selectedValues || {});
117118
const key = source.id || source.country;
118119
const country =
119-
countryFieldtype === 'name' ? mapData[key]?.name : mapData[key]?.country;
120+
countryFieldtype === 'name' ? mapData[key]?.name : mapData[key]?.code;
120121

121122
if (!country) {
122123
return undefined;
@@ -170,7 +171,7 @@ function WorldMap(element, props) {
170171
pointerEvent.preventDefault();
171172
const key = source.id || source.country;
172173
const val =
173-
countryFieldtype === 'name' ? mapData[key]?.name : mapData[key]?.country;
174+
countryFieldtype === 'name' ? mapData[key]?.name : mapData[key]?.code;
174175
let drillToDetailFilters;
175176
let drillByFilters;
176177
if (val) {

superset/viz.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,7 @@ def get_data(self, df: pd.DataFrame) -> VizData:
13131313
self.form_data["country_fieldtype"], row["country"]
13141314
)
13151315
if country:
1316+
row["code"] = country[self.form_data["country_fieldtype"]]
13161317
row["country"] = country["cca3"]
13171318
row["latitude"] = country["lat"]
13181319
row["longitude"] = country["lng"]

0 commit comments

Comments
 (0)