You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/05/25 16:48:19 UTC
[GitHub] mistercrunch closed pull request #5080: [bugfix] fix visualization
with adhocMetric
mistercrunch closed pull request #5080: [bugfix] fix visualization with adhocMetric
URL: https://github.com/apache/incubator-superset/pull/5080
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/superset/viz.py b/superset/viz.py
index f3db31c247..db09fb29f8 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -993,7 +993,7 @@ def as_floats(field):
def get_data(self, df):
df = df.fillna(0)
- df['metric'] = df[[self.metric]]
+ df['metric'] = df[[self.get_metric_label(self.metric)]]
values = df['metric'].values
return {
'measures': values.tolist(),
@@ -1324,8 +1324,8 @@ def get_data(self, df):
if self.form_data.get('granularity') == 'all':
raise Exception(_('Pick a time granularity for your time series'))
- metric = fd.get('metric')
- metric_2 = fd.get('metric_2')
+ metric = self.get_metric_label(fd.get('metric'))
+ metric_2 = self.get_metric_label(fd.get('metric_2'))
df = df.pivot_table(
index=DTTM_ALIAS,
values=[metric, metric_2])
@@ -1376,7 +1376,7 @@ def get_data(self, df):
df = df.pivot_table(
index=DTTM_ALIAS,
columns='series',
- values=fd.get('metric'))
+ values=self.get_metric_label(fd.get('metric')))
chart_data = self.to_series(df)
for serie in chart_data:
serie['rank'] = rank_lookup[serie['key']]
@@ -1544,8 +1544,8 @@ class SunburstViz(BaseViz):
def get_data(self, df):
fd = self.form_data
cols = fd.get('groupby')
- metric = fd.get('metric')
- secondary_metric = fd.get('secondary_metric')
+ metric = self.get_metric_label(fd.get('metric'))
+ secondary_metric = self.get_metric_label(fd.get('secondary_metric'))
if metric == secondary_metric or secondary_metric is None:
df.columns = cols + ['m1']
df['m2'] = df['m1']
@@ -1644,7 +1644,7 @@ def query_obj(self):
qry = super(ChordViz, self).query_obj()
fd = self.form_data
qry['groupby'] = [fd.get('groupby'), fd.get('columns')]
- qry['metrics'] = [fd.get('metric')]
+ qry['metrics'] = [self.get_metric_label(fd.get('metric'))]
return qry
def get_data(self, df):
@@ -1712,8 +1712,8 @@ def get_data(self, df):
from superset.data import countries
fd = self.form_data
cols = [fd.get('entity')]
- metric = fd.get('metric')
- secondary_metric = fd.get('secondary_metric')
+ metric = self.get_metric_label(fd.get('metric'))
+ secondary_metric = self.get_metric_label(fd.get('secondary_metric'))
if metric == secondary_metric:
ndf = df[cols]
# df[metric] will be a DataFrame
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org