pivot · v1.107.0
Pivot Table JavaScript: Live Cross-Tabs
A pivot table for JavaScript that is not a second component. Turn on pivotView and
the grid you already have shows one field down the side, another across the top and a measure
summed at every crossing, with subtotals that match the grid and a click that drills to the rows.
Try it live Read how to pivot data
the other way to pivot
Turn the values of a field into columns.
columns.pivot() takes the distinct values of a field and makes each one a column.
The headers sort and resize like any other, and a guard caps how many columns a field with many
distinct values can generate.
what it does
A cross-tab you can check against the rows.
Two axes, one measure
One field down the side, another across the top, and a measure summed at every crossing, with row, column and grand subtotals.
Totals that match the grid
Each cell and subtotal is the same reduction the totals row runs, over the same rows. An average subtotal is the average of the rows, never an average of cell averages.
Drill to the rows
Click a cell and the grid shows the rows behind that crossing, so a surprising figure is one click from the records that made it.
Several measures at once
Pivot Revenue and Units together, with a generated column group under every key and a choice of whether each group carries its own subtotal.
Guarded column count
columns.pivot() turns the distinct values of a field into columns, with a guard that caps how many a high-cardinality field can generate.
Built on the live rows
The pivot reads the same grid as everything else, so it follows the filters, and a derived grid can feed it a rolled-up or joined source.
demos
Run it, then change it.
The grid as a pivot table
Two axes, subtotals that match the grid, and a drill from any cell.
Pivot
Distinct values of a field become columns, with a column guard.
Pivot with several value columns
Generated column groups, and what the headings do.
docs
Reference and the rest of the grid.
How to pivot data in a grid
A runnable example, pivoted and flat.
Derived grids
Roll up or join the rows before you pivot them.
The grid
The engine the pivot reads from.
API reference
Every option and method.