Skip to content

Pivot Table Overview

The Pivot Table empowers users with the ability to transform multidimensional data into insightful visualizations. It allows for dynamic handling of data fields across rows, columns, and summary areas, all tailored to fit specific business needs.

Source code
src/components/pivot/Pivot.ts
import { defineCustomElements } from '@revolist/revogrid/loader';
defineCustomElements();
import { PivotPlugin } from '@revolist/revogrid-enterprise';
import { AdvanceFilterPlugin } from '@revolist/revogrid-pro';
import NumberColumnType from '@revolist/revogrid-column-numeral';
import { ECOMMERCE_PIVOT } from '../sys-data/ecommerce.pivot';
import type { DataType } from '@revolist/revogrid';
export function load(parentSelector: string, rows: DataType[]) {
const grid = document.createElement('revo-grid');
// Set grid properties
grid.range = true;
grid.resize = true;
grid.filter = true;
grid.colSize = 200;
grid.readonly = true;
grid.theme = 'compact';
// Set the data source
grid.source = rows;
// Define column types
grid.columnTypes = {
integer: new NumberColumnType(),
currency: new NumberColumnType('$0,0.00'),
};
// Define plugins
grid.plugins = [PivotPlugin, AdvanceFilterPlugin];
// Set additional data
grid.additionalData = {
pivot: {
...ECOMMERCE_PIVOT,
},
};
// Append the grid to the specified parent element
document.querySelector(parentSelector)?.appendChild(grid);
}

It may be helpful as you begin learning the capabilities of the Pivot Table component.

Pivot Grid

Perfect for applications requiring complex data analysis, this plugin ensures flexibility and control while maintaining high performance.

  1. Install the enterprise package

    Terminal window
    npm install @revolist/revogrid-enterprise
  2. Import the plugin and basic aggregators

    import { PivotPlugin, commonAggregators, type PivotConfig } from '@revolist/revogrid-enterprise';
  3. Register the plugin

    Add PivotPlugin to your grid’s plugins array:

    grid.plugins = [PivotPlugin];
  4. Define the pivot configuration

    Create a PivotConfig object specifying your dimensions, rows, columns, and value aggregators:

    const pivot: PivotConfig = {
    dimensions: [
    { prop: 'city' },
    { prop: 'age', sortable: true },
    {
    prop: 'dateOfBirth',
    aggregators: { count: commonAggregators.count },
    },
    ],
    rows: ['age'],
    columns: ['city'],
    values: [{ prop: 'dateOfBirth', aggregator: 'count' }],
    };
  5. Apply configuration to the grid

    Pass the config through the additionalData property:

    grid.additionalData = { pivot };

Highlights

  • Dynamic Pivoting: Easily switch between standard grid and pivot mode.
  • Interactive Configurator: Drag and drop fields with real-time updates.
  • Custom Aggregation: Apply built-in or custom summarization functions.
  • High Performance: Optimized for large datasets even in pivot mode.
  • i18n Support: Ready for global applications with translation support.

Experience the Pivot Table in action: Pivot Table Demo