[hotfix] fix world map

This commit is contained in:
Maxime Beauchemin 2017-03-03 21:20:25 -08:00
parent f6ffc00748
commit 9d8d421384
3 changed files with 8 additions and 7 deletions

View File

@ -266,9 +266,9 @@ export const controls = {
}),
},
country_controltype: {
country_fieldtype: {
type: 'SelectControl',
label: 'Country Control Type',
label: 'Country Field Type',
default: 'cca2',
choices: [
['name', 'Full name'],

View File

@ -572,7 +572,7 @@ const visTypes = {
label: null,
controlSetRows: [
['entity'],
['country_controltype'],
['country_fieldtype'],
['metric'],
],
},

View File

@ -1291,9 +1291,10 @@ class WorldMapViz(BaseViz):
def get_data(self, df):
from superset.data import countries
cols = [self.form_data.get('entity')]
metric = self.form_data.get('metric')
secondary_metric = self.form_data.get('secondary_metric')
fd = self.form_data
cols = [fd.get('entity')]
metric = fd.get('metric')
secondary_metric = fd.get('secondary_metric')
if metric == secondary_metric:
ndf = df[cols]
# df[metric] will be a DataFrame
@ -1310,7 +1311,7 @@ class WorldMapViz(BaseViz):
country = None
if isinstance(row['country'], string_types):
country = countries.get(
self.form_data.get('country_fieldtype'), row['country'])
fd.get('country_fieldtype'), row['country'])
if country:
row['country'] = country['cca3']