superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: Apply advanced analytics processing to comparison time series (#3373)
Date Fri, 25 Aug 2017 18:08:17 GMT
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 c944c61  Apply advanced analytics processing to comparison time series (#3373)
c944c61 is described below

commit c944c6174784af04bdc0b4aa76c0e59e59fa7ec8
Author: mxmzdlv <maxim.zudilov@gmail.com>
AuthorDate: Sat Aug 26 06:08:15 2017 +1200

    Apply advanced analytics processing to comparison time series (#3373)
---
 superset/viz.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/superset/viz.py b/superset/viz.py
index 98f2d1b..7c88aa1 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -853,7 +853,7 @@ class NVD3TimeSeriesViz(NVD3Viz):
             chart_data.append(d)
         return chart_data
 
-    def get_data(self, df):
+    def process_data(self, df):
         fd = self.form_data
         df = df.fillna(0)
         if fd.get("granularity") == "all":
@@ -909,6 +909,11 @@ class NVD3TimeSeriesViz(NVD3Viz):
 
             df = df[num_period_compare:]
 
+        return df
+
+    def get_data(self, df):
+        fd = self.form_data
+        df = self.process_data(df)
         chart_data = self.to_series(df)
 
         time_compare = fd.get('time_compare')
@@ -922,10 +927,7 @@ class NVD3TimeSeriesViz(NVD3Viz):
 
             df2 = self.get_df(query_object)
             df2[DTTM_ALIAS] += delta
-            df2 = df2.pivot_table(
-                index=DTTM_ALIAS,
-                columns=fd.get('groupby'),
-                values=fd.get('metrics'))
+            df2 = self.process_data(df2)
             chart_data += self.to_series(
                 df2, classed='superset', title_suffix="---")
             chart_data = sorted(chart_data, key=lambda x: x['key'])

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message