Engine
Totals and values placement
Pivot grand totals and subtotals with their positions, values on rows or columns at any level, empty members and the value header.
Grand totals and subtotals
totals: { grand: 'both', grandPosition: 'end', sub: true, subPosition: 'auto' }
grandcontrols the grand totals:'both','rows'(the grand total row only),'columns'(the grand total column only) or'none'.grandPositionputs them at the'start'or the'end'.subturns subtotals on or off. Set it totrueorfalse, or pass a record per field ({ year: false }). TheshowSubTotalsflag on a field placed on an axis overrides both.subPositionplaces subtotals. With'auto', the compact row header of an expanded member carries its subtotal and column subtotals follow their children. With'start', subtotals come before the children on both axes. With'end', they come after: rows get a separateAsia Totalrow (key'["Asia"]|total') and the member row holds no values.
An axis with no fields still shows one grand total position.
From code, pivot.setTotals({ grand: 'rows', sub: false }) merges into
totals (action totals); the totals, subtotals and grandTotals
toolbar items do the same from the UI
(Toolbar), and showSubTotals: false on a placed field (rows: [{ field: 'region', showSubTotals: false }])
hides that field's subtotals only.
Values placement
valuesPlacement: { axis, index } puts the measures on the 'columns' (the
default) or 'rows' axis, at level index among that axis's fields (-1
means innermost). With
{ axis: 'columns', index: 0 }, the measures are the outer column headers and
the column fields repeat under each one. On the rows axis, every member row
gets one child row per measure. With a single value field the value level is
hidden unless showValueHeader is true.
Empty members
By default an axis shows only member tuples that have rows.
showEmptyMembers: true shows every member of
a field under each parent, with empty cells. Members removed by a filter stay
hidden. The text shown in empty cells (emptyCellText) is a PivotTable
prop.
Totals, values placement and empty members
Open demoGrand totals and subtotals with their positions, measures on rows or columns at any level, the value header, empty members and the empty cell text, all from pivotModel.