You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2017/07/28 21:16:40 UTC
[incubator-superset] branch master updated: add combine config for
metrics in pivot table (#3086)
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 b58cfbc add combine config for metrics in pivot table (#3086)
b58cfbc is described below
commit b58cfbcb9124d6c43dfd9b748f777b07b101aa5f
Author: Rogan <qu...@gmail.com>
AuthorDate: Sat Jul 29 05:16:38 2017 +0800
add combine config for metrics in pivot table (#3086)
* add combine config for metrics in pivot table
* change method to stack/unstack
* update backendSync
---
superset/assets/backendSync.json | 6 ++++++
superset/assets/javascripts/explore/stores/controls.jsx | 8 ++++++++
superset/assets/javascripts/explore/stores/visTypes.js | 2 +-
superset/viz.py | 3 +++
4 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/superset/assets/backendSync.json b/superset/assets/backendSync.json
index 1d8ba55..71e7130 100644
--- a/superset/assets/backendSync.json
+++ b/superset/assets/backendSync.json
@@ -750,6 +750,12 @@
"default": false,
"description": "Sort bars by x labels."
},
+ "combine_metric": {
+ "type": "CheckboxControl",
+ "label": "Combine Metrics",
+ "default": false,
+ "description": "Display metrics side by side within each column, as opposed to each column being displayed side by side for each metric."
+ },
"show_controls": {
"type": "CheckboxControl",
"label": "Extra Controls",
diff --git a/superset/assets/javascripts/explore/stores/controls.jsx b/superset/assets/javascripts/explore/stores/controls.jsx
index 03d1fbd..3d4151b 100644
--- a/superset/assets/javascripts/explore/stores/controls.jsx
+++ b/superset/assets/javascripts/explore/stores/controls.jsx
@@ -249,6 +249,14 @@ export const controls = {
description: 'Sort bars by x labels.',
},
+ combine_metric: {
+ type: 'CheckboxControl',
+ label: 'Combine Metrics',
+ default: false,
+ description: 'Display metrics side by side within each column, as ' +
+ 'opposed to each column being displayed side by side for each metric.',
+ },
+
show_controls: {
type: 'CheckboxControl',
label: 'Extra Controls',
diff --git a/superset/assets/javascripts/explore/stores/visTypes.js b/superset/assets/javascripts/explore/stores/visTypes.js
index 7291286..4dd2700 100644
--- a/superset/assets/javascripts/explore/stores/visTypes.js
+++ b/superset/assets/javascripts/explore/stores/visTypes.js
@@ -337,7 +337,7 @@ export const visTypes = {
controlSetRows: [
['groupby', 'columns'],
['metrics', 'pandas_aggfunc'],
- ['number_format', 'pivot_margins'],
+ ['number_format', 'combine_metric', 'pivot_margins'],
],
},
],
diff --git a/superset/viz.py b/superset/viz.py
index 19ff165..de1f635 100755
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -402,6 +402,9 @@ class PivotTableViz(BaseViz):
aggfunc=self.form_data.get('pandas_aggfunc'),
margins=self.form_data.get('pivot_margins'),
)
+ # Display metrics side by side with each column
+ if self.form_data.get('combine_metric'):
+ df = df.stack(0).unstack()
return dict(
columns=list(df.columns),
html=df.to_html(
--
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <co...@superset.apache.org>'].