Skip to content

Commit

Permalink
Add 'show/hide totals' option to pivot table vis (#3101)
Browse files Browse the repository at this point in the history
  • Loading branch information
RichRadics authored and mistercrunch committed Jul 26, 2017
1 parent 7654eef commit 4268513
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions superset/assets/javascripts/explore/stores/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ export const controls = {
description: null,
},

pivot_margins: {
type: 'CheckboxControl',
label: 'Show totals',
renderTrigger: false,
default: true,
description: 'Display total row/column',
},

show_markers: {
type: 'CheckboxControl',
label: 'Show Markers',
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/javascripts/explore/stores/visTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export const visTypes = {
controlSetRows: [
['groupby', 'columns'],
['metrics', 'pandas_aggfunc'],
['number_format'],
['number_format', 'pivot_margins'],
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def get_data(self, df):
columns=self.form_data.get('columns'),
values=self.form_data.get('metrics'),
aggfunc=self.form_data.get('pandas_aggfunc'),
margins=True,
margins=self.form_data.get('pivot_margins'),
)
return dict(
columns=list(df.columns),
Expand Down

0 comments on commit 4268513

Please sign in to comment.