This is an automated email from the ASF dual-hosted git repository.
graceguo 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 0782e83 fix inaccurate data calculation with adata rolling and
contribution (#7035)
0782e83 is described below
commit 0782e831cd37f665a2838119d87c433269f1b36b
Author: Conglei <[email protected]>
AuthorDate: Thu Mar 14 14:05:06 2019 -0700
fix inaccurate data calculation with adata rolling and contribution (#7035)
---
superset/viz.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/superset/viz.py b/superset/viz.py
index de33a3c..ef7ee45 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1184,10 +1184,6 @@ class NVD3TimeSeriesViz(NVD3Viz):
dfs.sort_values(ascending=False, inplace=True)
df = df[dfs.index]
- if fd.get('contribution'):
- dft = df.T
- df = (dft / dft.sum()).T
-
rolling_type = fd.get('rolling_type')
rolling_periods = int(fd.get('rolling_periods') or 0)
min_periods = int(fd.get('min_periods') or 0)
@@ -1207,6 +1203,10 @@ class NVD3TimeSeriesViz(NVD3Viz):
if min_periods:
df = df[min_periods:]
+ if fd.get('contribution'):
+ dft = df.T
+ df = (dft / dft.sum()).T
+
return df
def run_extra_queries(self):