From commits-return-1029-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Fri May 25 18:48:30 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B8634180627 for ; Fri, 25 May 2018 18:48:29 +0200 (CEST) Received: (qmail 28263 invoked by uid 500); 25 May 2018 16:48:28 -0000 Mailing-List: contact commits-help@superset.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.incubator.apache.org Delivered-To: mailing list commits@superset.incubator.apache.org Received: (qmail 28248 invoked by uid 99); 25 May 2018 16:48:28 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2018 16:48:28 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 51D5282F8E; Fri, 25 May 2018 16:48:27 +0000 (UTC) Date: Fri, 25 May 2018 16:48:27 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: [bugfix] fix visualization with adhocMetric (#5080) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <152726690712.24795.17507003989401055385@gitbox.apache.org> From: maximebeauchemin@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: e30215c3d8ce52e167889ad40c4ada4d00a2f352 X-Git-Newrev: c18ef8903409c20b8526b9acd12d3ba1c4c3664b X-Git-Rev: c18ef8903409c20b8526b9acd12d3ba1c4c3664b X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. maximebeauchemin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git The following commit(s) were added to refs/heads/master by this push: new c18ef89 [bugfix] fix visualization with adhocMetric (#5080) c18ef89 is described below commit c18ef8903409c20b8526b9acd12d3ba1c4c3664b Author: Yongjie Zhao AuthorDate: Sat May 26 00:48:18 2018 +0800 [bugfix] fix visualization with adhocMetric (#5080) * fix visualization with adhocMetric * update --- superset/viz.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/superset/viz.py b/superset/viz.py index f3db31c..db09fb2 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -993,7 +993,7 @@ class BulletViz(NVD3Viz): 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 @@ class NVD3DualLineViz(NVD3Viz): 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 @@ class NVD3TimePivotViz(NVD3TimeSeriesViz): 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 @@ class ChordViz(BaseViz): 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 @@ class WorldMapViz(BaseViz): 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 -- To stop receiving notification emails like this one, please contact maximebeauchemin@apache.org.