Implementing Angular Pivot Grid
The Syncfusion Angular Pivot Grid is a powerful data visualization and analysis component for creating interactive pivot tables, aggregating multidimensional data, and performing advanced analytics operations.
Important: Always verify API class names, properties, and method signatures by consulting the reference files in this skill (references/*.md). These are maintained with verified, working examples. Do not assume API details from other sources.
⚠️ Security Warning: Data Source Validation
CRITICAL SECURITY NOTICE: When implementing pivot tables, always use trusted data sources. Never fetch or bind data from untrusted or user-provided URLs without proper validation and sanitization.
Security Best Practices:
- Use Local Data: Prefer local, in-memory data sources for maximum security
- Validate Remote Sources: Only connect to authenticated and authorized API endpoints under your control
- Sanitize User Input: Never allow users to specify arbitrary URLs or data sources
- Implement Authentication: Always use authentication headers and secure API endpoints
- Content Validation: Validate and sanitize all data received from external sources before binding
- Use HTTPS: Always use HTTPS for remote data connections
- Rate Limiting: Implement rate limiting on API endpoints to prevent abuse
Security Risks:
- Indirect Prompt Injection: Untrusted third-party data can contain malicious content that manipulates AI agent behavior
- Data Exfiltration: Malicious data sources could attempt to extract sensitive information
- Code Injection: Untrusted data may contain scripts or harmful content
Recommended Approach:
✅ DO: Use controlled, authenticated backend APIs
✅ DO: Implement server-side data validation
✅ DO: Use environment variables for API endpoints
✅ DO: Whitelist allowed data sources
❌ DON'T: Accept user-provided URLs
❌ DON'T: Bind to public, untrusted endpoints
❌ DON'T: Skip data validation and sanitization
❌ DON'T: Use HTTP for sensitive data
When to Use This Skill
Use this skill when users need to:
- Create and configure pivot tables from multidimensional data
- Bind data from OLAP or relational data sources
- Aggregate data with multiple aggregation functions (Sum, Avg, Count, etc.)
- Group data by number ranges, dates, or custom categories
- Create and manage calculated fields with formulas
- Enable drill-down and drill-through operations
- Visualize data with integrated pivot charts
- Apply custom formatting and conditional styling
- Optimize large dataset performance
- Export pivot grid data to Excel or PDF
- Persist and restore pivot grid state
- Customize UI with field lists, grouping bars, and toolbars
Documentation Guide
Getting Started
📄 Read: references/getting-started.md
- Installation and package setup (Angular 21 standalone architecture)
- Basic Angular Pivot Grid implementation
- Theme packages — use the consolidated
@syncfusion/ej2-{theme}-theme packages (e.g. ej2-material3-theme) with a single styles/pivotview/index.css import
- CSS imports and theme configuration
- Component initialization (
PivotViewModule, bootstrapApplication)
Aggregation
📄 Read: references/aggregation.md
- Aggregation functions: Sum, Avg, Count, Min, Max, Product, Median, DistinctCount
- Advanced aggregations: DifferenceFrom, PercentageOfDifferenceFrom, PercentageOfParentTotal
- Parent-total aggregations:
PercentageOfParentColumnTotal, PercentageOfParentRowTotal (axis-scoped % of parent)
- Running-totals aggregations:
RunningTotals and PercentageOfRunningTotals (cumulative % of grand total; client-side only)
- Base field configuration with baseField and baseItem properties
- Multiple aggregations on same field
- Customizing aggregation dropdown and UI
- Runtime aggregation type changes
- Events: aggregateCellInfo, actionBegin, actionComplete, actionFailure
Grouping
📄 Read: references/grouping.md
- Enable grouping with
allowGrouping: true and inject GroupingService
- Number grouping: Configure ranges with rangeInterval, startingAt, endingAt
- Date grouping: Organize by Years, Quarters, Months, Days, Hours, Minutes, Seconds
- Custom grouping: Group data by business-defined categories
- UI-based grouping through context menu
- Ungrouping and programmatic ungrouping
- Common grouping patterns and troubleshooting
Calculated Fields
📄 Read: references/calculated-field.md
- Creating calculated fields interactively and programmatically
- Enabling with
allowCalculatedField: true, injecting CalculatedFieldService
- Defining with
calculatedFieldSettings (name, formula)
- Adding to values array with
type: 'CalculatedField'
- Editing/renaming fields through UI (Field List, Grouping Bar)
- Formula syntax: Operators (+, -, , /, ^, <, >, ==, !=, &, |, ?), Functions (abs, min, max, isNaN, Math.)
- Aggregation functions in formulas: Sum, Count, Avg, Min, Max
- Formatting with separate
formatSettings array: Currency (C), Number (N), Percentage (P)
- Events: calculatedFieldCreate (validation), actionBegin/actionComplete (control operations)
Pivot Chart Integration
📄 Read: references/pivot-chart-integration.md
- Inject
PivotChartService provider to enable chart functionality
- Chart types: 21+ types including Line, Column, Area, Bar, StepArea, Pie, Doughnut, Funnel, Pyramid, Radar, Polar, Pareto, Bubble, Scatter, Spline
- Display options: Configure with
displayOption property to show Table, Chart, or Both with view and primary settings
- Series customization: Customize charts via
chartSeries in chartSettings (type, marker, dataLabel)
- Field list integration: Enable with
showFieldList: true for dynamic field manipulation
- Grouping bar support: Enable with
showGroupingBar: true for axis field switching
- Axis configuration: Customize X/Y axes via
primaryXAxis and primaryYAxis in chartSettings
- Multiple axes: Configure
enableMultipleAxis for multi-value visualization with multipleAxisMode
- Accumulation chart drill: Support drill-down/up on Pie, Doughnut, Funnel, Pyramid via context menu
Filtering & Sorting
📄 Read: references/filtering-and-sorting.md
- Member filtering: Include or exclude specific field members (Include/Exclude, with
levelCount for OLAP)
- Append current selection to filter: Accumulate selections in the Member Editor instead of replacing them
- Member editor UX: Select/unselect all, search members, sort members in the editor
- Limit members displayed: Tune
maxNodeLimitInMemberEditor for large hierarchies
- OLAP member loading: On-demand loading via
loadOnDemandInMemberEditor and levelCount
- Label filtering: Filter header text by string (Equals, Contains, BeginWith, Between, ...), number, or date
- Value filtering: Filter by aggregated values with operators (Equals, GreaterThan, Between, ...) and Top/Bottom N members
- Filtering events:
memberFiltering, memberEditorOpen, actionBegin/actionComplete/actionFailure
- Member sorting: Arrange field members in ascending/descending order
- Custom member sorting: Sort field members in user-defined order using
membersOrder
- Value sorting: Sort pivot table values and aggregated data with
enableValueSorting
- Programmatic value sorting: Configure with
valueSortSettings
Data Formatting & Conditional Formatting
📄 Read: references/data-formatting.md
- Number formatting: Apply Currency (C), Percentage (P), Number (N), Scientific (E) formats
- Custom format strings: Define format strings with placeholders for calculated fields
- Conditional formatting: Apply colors/styles based on cell values using
conditionalFormatSettings
- Format settings configuration: Configure in separate
formatSettings array in dataSourceSettings
Export & Printing
📄 Read: references/export-and-print.md
- Excel export:
excelExport() with custom properties, themes
- PDF export:
pdfExport() with headers, footers, page orientation
- CSV export:
csvExport() for large datasets (1M+ rows)
- Print functionality:
print() method for table and chart
- Multi-table export: Combine multiple pivot tables in single file
- Export customization: Cell styling, color themes, branding
UI Customization
📄 Read: references/ui-customization.md
- Toolbar configuration: Show/hide built-in toolbar items
- Report management: New, Save, Load, Delete reports
- View switching: Toggle between Grid and Chart modes
- Export options: Quick export buttons
- Grand totals/Subtotals: Show/hide and customize positioning
- Custom templates: Build custom toolbar or field list
Grouping Bar UI Operations
📄 Read: references/grouping-bar-ui-operations.md
- Enable grouping bar: Set
showGroupingBar: true on component
- Drag-and-drop reorganization: Move fields between Row, Column, Value, Filter axes
- Filter operations: Access filters from grouping bar field buttons
- Sort operations: Configure sort options via grouping bar interface
- Remove operations: Remove fields directly from grouping bar
- Value field management: Switch between value fields in accumulation charts
- Hide specific icons: Control visibility of filter, sort, remove icons per field
- Grouping bar customization: Configure via
groupingBarSettings
Tooltips Customization
📄 Read: references/tooltips-customization.md
- Enable/disable tooltips: Configure tooltip visibility on cells and charts
- Custom tooltip templates: Define dynamic tooltip content with placeholders
- Available placeholders: Row headers, column headers, value, and other cell metadata
- Pivot chart tooltip customization: Customize tooltip appearance for chart data points
- CSS styling: Style tooltip appearance with custom CSS
- Dynamic tooltip content: Configure based on cell values and context
Editing & Drill Operations
📄 Read: references/editing-drill-operations.md
- Enable editing: Set
allowEditing: true on component (relational data only)
- Edit modes: Normal (inline), Dialog (popup), Batch (multiple), Command Column (dedicated)
- Edit settings: Configure via
editSettings with allowAdding, allowDeleting, allowCommandColumns
- Edit events: Monitor
editCompleted, actionBegin, actionComplete, actionFailure
- CRUD operations: Create, Read, Update, Delete records via editing interface
- Drill-through operations: View raw underlying data for aggregated values via context menu
- Drill-down operations: Click cells to navigate hierarchical data deeper
- Cell selection: Configure via
selectionSettings
- Save data: Updated records persist via event handlers and data binding
OLAP Data Sources
📄 Read: references/olap-data-sources.md
- Connection configuration: Set
url, catalog, cube, providerType: 'SSAS' in dataSourceSettings
- OLAP cube elements: Measures (numeric aggregates), Dimensions (hierarchical groupings), Hierarchies, Named Sets
- MDX support: Configure using MDX (Multidimensional Expressions) syntax for queries
- Hierarchies: Access via
[Dimension].[Hierarchy] notation (e.g., [Date].[Date Hierarchy])
- Calculated fields: Create Calculated Measures and Dimensions in OLAP cubes
- Authentication: Configure via connection string or backend authentication headers
- Named sets: Predefined member groups for analysis
- Advanced features: Drill-down, virtual scrolling, value filtering with OLAP
Paging Configuration
📄 Read: references/paging-configuration.md
- Enable paging with
enablePaging: true and inject PagerService
- Page settings:
rowPageSize, columnPageSize, currentRowPage, currentColumnPage
- Pager UI configuration and positioning (Top/Bottom)
- Row vs column paging
- Compact view and inverse pager layout
- Custom page size options in dropdown
- Paging with virtual scrolling for optimization
- Server-side paging for huge datasets
- Mobile-optimized paging
Virtual Scrolling
📄 Read: references/virtual-scrolling.md
- Enable virtual scrolling with
enableVirtualization: true for large datasets
- Single page mode: Use
allowSinglePage: true to render only current view page
- Limitations: pixel-based columnWidth, avoid runtime sizing changes
- Static FieldList synchronization using
enginePopulated events and update/updateView methods
- Performance optimization for 100K+ rows on client-side
Drill-Down & Drill-Through Operations
📄 Read: references/drill-down.md
- Drill-down: Navigate hierarchical data by clicking cells
- Drill-up: Navigate back to higher levels
- Drill-through: View raw underlying data for aggregated values
- Events:
cellClick, fieldDrop, fieldsUpdated for drill interactions
- Context menu: Built-in drill operations
Database Connections
📄 Read: references/database-connections.md
- SQL Server: Connect via connection strings with SQL authentication
- MySQL: Configure with host, port, user, password, and database
- PostgreSQL: Connection configuration for PostgreSQL databases
- Oracle: Oracle database connectivity with named parameters
- MongoDB: Connect to MongoDB collections and query documents
- Elasticsearch: Big data analytics via Elasticsearch indices
- Snowflake: Cloud data warehouse integration
- Server-side processing: Use ASP.NET Core backend with database queries
Server-Side Pivot Engine
📄 Read: references/server-side-pivot-engine.md
- Server-side aggregation: Delegate heavy processing to ASP.NET Core backend
- Client configuration: Set
mode: 'Server' with url endpoint in dataSourceSettings
- ASP.NET Core setup: Download and configure PivotController with Syncfusion.Pivot.Engine NuGet
- Data sources: Support Collection, JSON, CSV, DataTable, Dynamic objects on server
- Large datasets: Handle 100K+ rows with server-side processing
- Virtual scrolling: Combine with server mode for optimal performance
- Export operations: Excel/CSV export of server-processed data
- Authentication: Configure via beforeServiceInvoke event or headers
Performance Optimization
📄 Read: references/performance-optimization.md
- Virtual scrolling: Enable with
enableVirtualization: true for 100K+ rows
- Single page mode: Use
allowSinglePage: true for better performance
- Paging: Configure with
pageSettings for row/column pagination
- Data compression: Enable
allowDataCompression: true for duplicate record summarization
- Deferred updates: Use
allowDeferLayoutUpdate: true to batch field operations
- Large dataset handling: Server-side processing with
mode: 'Server'
- Best practices: Pre-filtering, optimized sorting, member filtering limits, avoiding built-in grouping
State Persistence & Hyperlinks
📄 Read: references/state-persistence-hyperlinks.md
- State persistence: Save and restore pivot configuration using
getPersistData()
- Local storage: Persist report state in browser localStorage for user sessions
- Report management: Save, load, and delete named reports
- JSON serialization: Export/import report configurations as JSON
- Hyperlinks: Enable clickable hyperlinks in pivot cells via
hyperlinkSettings
- Hyperlink events: Handle hyperlink clicks with appropriate event handlers
- Drill-through hyperlinks: Links to detailed data sources for aggregates
Quick Start Example
import { PivotViewAllModule, CalculatedFieldService } from '@syncfusion/ej2-angular-pivotview';
import { Component, OnInit, ViewChild } from '@angular/core';
import { PivotViewComponent, IDataSet } from '@syncfusion/ej2-angular-pivotview';
import { DataSourceSettingsModel } from '@syncfusion/ej2-pivotview/src/model/datasourcesettings-model';
@Component({
imports: [PivotViewAllModule],
providers: [CalculatedFieldService],
standalone: true,
selector: 'app-pivot-grid',
template: `
<ejs-pivotview #pivotview id='PivotView'
[dataSourceSettings]="dataSourceSettings"
[height]="'500px'"
[width]="'100%'"
[allowCalculatedField]="true"
[allowGrouping]="true"
[toolbar]="toolbarItems">
</ejs-pivotview>
`
})
export class AppComponent implements OnInit {
@ViewChild('pivotview') pivotViewComponent!: PivotViewComponent;
public pivotData!: IDataSet[];
public dataSourceSettings!: DataSourceSettingsModel;
public toolbarItems: string[] = ['New', 'Save', 'SaveAs', 'Rename', 'Remove', 'Load', 'Export'];
ngOnInit(): void {
this.pivotData = [
{ 'Sold': 31, 'Amount': 52824, 'Country': 'France', 'Products': 'Mountain Bikes', 'Year': 'FY 2015', 'Quarter': 'Q1' },
{ 'Sold': 51, 'Amount': 86904, 'Country': 'France', 'Products': 'Mountain Bikes', 'Year': 'FY 2015', 'Quarter': 'Q2' },
{ 'Sold': 90, 'Amount': 153360, 'Country': 'France', 'Products': 'Mountain Bikes', 'Year': 'FY 2015', 'Quarter': 'Q3' },
{ 'Sold': 25, 'Amount': 42500, 'Country': 'France', 'Products': 'Road Bikes', 'Year': 'FY 2015', 'Quarter': 'Q1' },
{ 'Sold': 40, 'Amount': 68000, 'Country': 'Germany', 'Products': 'Mountain Bikes', 'Year': 'FY 2015', 'Quarter': 'Q2' }
];
this.dataSourceSettings = {
dataSource: this.pivotData,
expandAll: false,
rows: [{ name: 'Country' }, { name: 'Products' }],
columns: [{ name: 'Year' }, { name: 'Quarter' }],
values: [
{ name: 'AvgAmount', type: 'CalculatedField' },
{ name: 'Sold', type: 'Count' }
],
calculatedFieldSettings: [
{
name: 'AvgAmount',
formula: '"Sum(Amount)"/"Count(Sold)"' // Calculated field: Average
}
],
formatSettings: [
{ name: 'Amount', format: 'C2' }, // Currency format
{ name: 'AvgAmount', format: 'C2' } // Format calculated field
]
};
}
}
Common Patterns
Pattern 1: Multiple Fields with Different Aggregation Types
Each field supports only ONE aggregation type. To analyze different aspects, use different fields with their respective aggregation functions:
values: [
{ name: 'Amount', type: 'Sum' }, // Total sales amount
{ name: 'Quantity', type: 'Avg' }, // Average quantity sold
{ name: 'Sold', type: 'Count' }, // Number of transactions
{ name: 'Price', type: 'Min' }, // Minimum price
]
Note: Each field in the values array can only have ONE type. To get multiple aggregation types for analysis, use different fields or create calculated fields combining aggregations.
Pattern 2: Hierarchical Grouping
Organize data with multi-level grouping:
rows: [
{ name: 'Country' }, // Primary level
{ name: 'Region' }, // Secondary level
{ name: 'City' } // Tertiary level
],
columns: [
{ name: 'Year' }, // Year level
{ name: 'Quarter' } // Quarter level
]
Pattern 3: Using Calculated Fields with Aggregations
Combine calculated fields with multiple aggregation types for advanced analysis:
values: [
{ name: 'Amount', type: 'Sum' }, // Total amount
{ name: 'Quantity', type: 'Avg' }, // Average quantity
{ name: 'AvgRevenue', type: 'CalculatedField' } // Custom calculation
],
calculatedFieldSettings: [
{
name: 'AvgRevenue',
formula: '"Sum(Amount)" / "Count(Quantity)"' // Revenue per unit
}
],
formatSettings: [
{ name: 'Amount', format: 'C2' }, // Currency format for Amount
{ name: 'AvgRevenue', format: 'C2' } // Currency format for calculated field
]
Pattern 4: Number Range Grouping
Group numeric fields into ranges:
groupSettings: [
{
name: 'ProductID',
type: 'Number',
rangeInterval: 5,
startingAt: 1000,
endingAt: 1010
}
]
Pattern 5: Date Hierarchy Grouping
Organize dates with time-based hierarchies:
groupSettings: [
{
name: 'OrderDate',
type: 'Date',
groupInterval: ['Years', 'Months'], // Year then month hierarchy
startingAt: new Date(2020, 0, 1),
endingAt: new Date(2023, 11, 31)
}
]
Key Configuration Properties
| Property |
Type |
Location |
Purpose |
rows |
Array |
dataSourceSettings |
Fields organized vertically for grouping data |
columns |
Array |
dataSourceSettings |
Fields organized horizontally for grouping data |
values |
Array |
dataSourceSettings |
Fields to aggregate with type (Sum, Avg, Count, CalculatedField, etc.) |
filters |
Array |
dataSourceSettings |
Fields used to filter data across both axes |
type |
String |
values field |
Aggregation type: Sum, Avg, Count, Min, Max, Product, DistinctCount, Median, RunningTotals, PercentageOfRunningTotals (client-side only), DifferenceFrom, PercentageOfDifferenceFrom, PercentageOfGrandTotal, PercentageOfColumnTotal, PercentageOfRowTotal, PercentageOfParentTotal, PercentageOfParentColumnTotal, PercentageOfParentRowTotal, PopulationStDev, SampleStDev, PopulationVar, SampleVar, Index, CalculatedField |
baseField |
String |
values field |
Field reference for DifferenceFrom/Percentage-based comparisons (base field aggregation) |
baseItem |
String |
values field |
Specific member for base field comparisons |
allowCalculatedField |
Boolean |
Component |
Enable calculated field feature (requires CalculatedFieldService provider) |
calculatedFieldSettings |
Array |
dataSourceSettings |
Define calculated field name and formula properties |
formula |
String |
calculatedFieldSettings |
Mathematical expression using aggregation functions (Sum, Count, Avg, Min, Max) and operators (+, -, *, /, ^, <, >, ==, !=, &, |, ?) |
formatSettings |
Array |
dataSourceSettings |
SEPARATE array for number formatting (C, N, P, E) of value fields and calculated fields |
allowGrouping |
Boolean |
Component |
Enable grouping feature (requires GroupingService provider) |
groupSettings |
Array |
dataSourceSettings |
Configure number, date, or custom grouping with name, type, rangeInterval, groupInterval |
groupInterval |
Array |
groupSettings |
Grouping hierarchy (Years, Quarters, Months, Days, Hours, Minutes, Seconds) |
aggregateTypes |
Array |
Component |
Restrict aggregation dropdown to specific types (array of AggregateTypes) |
showAggregationOnValueField |
Boolean |
dataSourceSettings |
Display aggregation type in grouping bar button text (e.g., "Sum of Amount" vs "Amount") |
sortSettings |
Array |
dataSourceSettings |
Configure field sorting with order, membersOrder, name properties |
enableValueSorting |
Boolean |
Component |
Enable sorting by aggregated values |
allowMemberFilter |
Boolean |
dataSourceSettings |
Enable/disable member filter UI (default true) |
allowLabelFilter |
Boolean |
dataSourceSettings |
Enable label filter UI for header text/number/date filtering |
allowValueFilter |
Boolean |
dataSourceSettings |
Enable value filter UI for aggregate-based filtering |
filterSettings |
Array |
dataSourceSettings |
Programmatic filter criteria with name, type (Include/Exclude/Label/Number/Date/Value), condition, value1, value2, measure, items, levelCount, selectedField |
condition (Top/Bottom) |
String |
filterSettings (type: 'Value') |
Top/Bottom N members by aggregated value of the chosen measure (client-side only) |
maxNodeLimitInMemberEditor |
Number |
Component |
Max members shown in the Member Editor before showing a "more items" message (default 1000) |
loadOnDemandInMemberEditor |
Boolean |
Component |
OLAP-only: load only the first hierarchy level until expansion/level-select (default true) |
Important: When adding calculated fields to values, use type: 'CalculatedField' to distinguish them from regular aggregations. Format settings must be applied in a separate formatSettings array, not within the value field object.
Next Steps
Foundation (Start here):
- Read Getting Started for setup and initialization
- Read Aggregation to implement aggregation functions and base field aggregations
- Read Grouping to configure number, date, and custom grouping
Data Manipulation:
4. Read Calculated Fields for complex calculations and custom field formulas
5. Read Filtering & Sorting for label/value filtering and custom sorting
6. Read Data Formatting for number formats and conditional formatting
Visualization & Interaction:
7. Read Pivot Chart Integration for charting and drill operations
8. Read UI Customization for toolbars and custom interfaces
9. Read Drill-Down & Drill-Through for hierarchical data exploration
Advanced Features:
10. Read Export & Printing for multi-format export (Excel, PDF, CSV)
11. Read State Persistence for saving and restoring configurations
12. Read Database Connections for SQL/NoSQL/big data integration
13. Read Server-Side Pivot Engine for processing 100K+ rows on backend
14. Read Performance Optimization for large datasets, deferred updates, and virtual scrolling
Foundational References
These files provide foundational knowledge and may be referenced by feature guides:
📄 references/core-concepts.md - Data binding types (JSON, CSV, OLAP), client-side vs server-side comparison, choosing appropriate data sources
📄 references/layout-and-columns.md - Classic layout, row/column sizing, column features, cell selection and customization
📄 references/field-list.md - Field list UI (popup/fixed modes), field organization, deferred updates patterns
1---2name: syncfusion-angular-pivot-table3description: Use this skill when users ask how to build or customize Syncfusion PivotView pivot tables in Angular. Trigger for Angular pivot grid/OLAP, aggregation, data binding (JSON/remote), drill-down/drill-through, grouping, filtering, conditional formatting, exports (Excel/PDF/CSV), or pivot charts. Angular-only, not React/Vue/Blazor.4---56# Implementing Angular Pivot Grid78The Syncfusion Angular Pivot Grid is a powerful data visualization and analysis component for creating interactive pivot tables, aggregating multidimensional data, and performing advanced analytics operations.910**Important:** Always verify API class names, properties, and method signatures by consulting the **reference files in this skill** (`references/*.md`). These are maintained with verified, working examples. Do not assume API details from other sources.1112## ⚠️ Security Warning: Data Source Validation1314**CRITICAL SECURITY NOTICE:** When implementing pivot tables, always use trusted data sources. **Never** fetch or bind data from untrusted or user-provided URLs without proper validation and sanitization.1516### Security Best Practices:17181. **Use Local Data**: Prefer local, in-memory data sources for maximum security192. **Validate Remote Sources**: Only connect to authenticated and authorized API endpoints under your control203. **Sanitize User Input**: Never allow users to specify arbitrary URLs or data sources214. **Implement Authentication**: Always use authentication headers and secure API endpoints225. **Content Validation**: Validate and sanitize all data received from external sources before binding236. **Use HTTPS**: Always use HTTPS for remote data connections247. **Rate Limiting**: Implement rate limiting on API endpoints to prevent abuse2526### Security Risks:2728- **Indirect Prompt Injection**: Untrusted third-party data can contain malicious content that manipulates AI agent behavior29- **Data Exfiltration**: Malicious data sources could attempt to extract sensitive information30- **Code Injection**: Untrusted data may contain scripts or harmful content3132### Recommended Approach:3334✅ **DO**: Use controlled, authenticated backend APIs35✅ **DO**: Implement server-side data validation36✅ **DO**: Use environment variables for API endpoints37✅ **DO**: Whitelist allowed data sources3839❌ **DON'T**: Accept user-provided URLs40❌ **DON'T**: Bind to public, untrusted endpoints41❌ **DON'T**: Skip data validation and sanitization42❌ **DON'T**: Use HTTP for sensitive data4344## When to Use This Skill4546Use this skill when users need to:47- Create and configure pivot tables from multidimensional data48- Bind data from OLAP or relational data sources49- Aggregate data with multiple aggregation functions (Sum, Avg, Count, etc.)50- Group data by number ranges, dates, or custom categories51- Create and manage calculated fields with formulas52- Enable drill-down and drill-through operations53- Visualize data with integrated pivot charts54- Apply custom formatting and conditional styling55- Optimize large dataset performance56- Export pivot grid data to Excel or PDF57- Persist and restore pivot grid state58- Customize UI with field lists, grouping bars, and toolbars5960## Documentation Guide6162### Getting Started63📄 **Read:** [references/getting-started.md](references/getting-started.md)64- Installation and package setup (Angular 21 standalone architecture)65- Basic Angular Pivot Grid implementation66- **Theme packages** — use the consolidated `@syncfusion/ej2-{theme}-theme` packages (e.g. `ej2-material3-theme`) with a single `styles/pivotview/index.css` import67- CSS imports and theme configuration68- Component initialization (`PivotViewModule`, `bootstrapApplication`)6970### Aggregation71📄 **Read:** [references/aggregation.md](references/aggregation.md)72- Aggregation functions: Sum, Avg, Count, Min, Max, Product, Median, DistinctCount73- Advanced aggregations: DifferenceFrom, PercentageOfDifferenceFrom, PercentageOfParentTotal74- Parent-total aggregations: `PercentageOfParentColumnTotal`, `PercentageOfParentRowTotal` (axis-scoped % of parent)75- Running-totals aggregations: `RunningTotals` and **`PercentageOfRunningTotals`** (cumulative % of grand total; client-side only)76- Base field configuration with baseField and baseItem properties77- Multiple aggregations on same field78- Customizing aggregation dropdown and UI79- Runtime aggregation type changes80- Events: aggregateCellInfo, actionBegin, actionComplete, actionFailure8182### Grouping83📄 **Read:** [references/grouping.md](references/grouping.md)84- Enable grouping with `allowGrouping: true` and inject `GroupingService`85- Number grouping: Configure ranges with rangeInterval, startingAt, endingAt86- Date grouping: Organize by Years, Quarters, Months, Days, Hours, Minutes, Seconds87- Custom grouping: Group data by business-defined categories88- UI-based grouping through context menu89- Ungrouping and programmatic ungrouping90- Common grouping patterns and troubleshooting9192### Calculated Fields93📄 **Read:** [references/calculated-field.md](references/calculated-field.md)94- Creating calculated fields interactively and programmatically95- Enabling with `allowCalculatedField: true`, injecting `CalculatedFieldService`96- Defining with `calculatedFieldSettings` (name, formula)97- Adding to values array with `type: 'CalculatedField'`98- Editing/renaming fields through UI (Field List, Grouping Bar)99- Formula syntax: Operators (+, -, *, /, ^, <, >, ==, !=, &, |, ?), Functions (abs, min, max, isNaN, Math.*)100- Aggregation functions in formulas: Sum, Count, Avg, Min, Max101- Formatting with separate `formatSettings` array: Currency (C), Number (N), Percentage (P)102- Events: calculatedFieldCreate (validation), actionBegin/actionComplete (control operations)103104### Pivot Chart Integration105📄 **Read:** [references/pivot-chart-integration.md](references/pivot-chart-integration.md)106- Inject `PivotChartService` provider to enable chart functionality107- Chart types: 21+ types including Line, Column, Area, Bar, StepArea, Pie, Doughnut, Funnel, Pyramid, Radar, Polar, Pareto, Bubble, Scatter, Spline108- Display options: Configure with `displayOption` property to show Table, Chart, or Both with `view` and `primary` settings109- Series customization: Customize charts via `chartSeries` in `chartSettings` (type, marker, dataLabel)110- Field list integration: Enable with `showFieldList: true` for dynamic field manipulation111- Grouping bar support: Enable with `showGroupingBar: true` for axis field switching112- Axis configuration: Customize X/Y axes via `primaryXAxis` and `primaryYAxis` in `chartSettings`113- Multiple axes: Configure `enableMultipleAxis` for multi-value visualization with `multipleAxisMode`114- Accumulation chart drill: Support drill-down/up on Pie, Doughnut, Funnel, Pyramid via context menu115116### Filtering & Sorting117📄 **Read:** [references/filtering-and-sorting.md](references/filtering-and-sorting.md)118- **Member filtering**: Include or exclude specific field members (Include/Exclude, with `levelCount` for OLAP)119- **Append current selection to filter**: Accumulate selections in the Member Editor instead of replacing them120- **Member editor UX**: Select/unselect all, search members, sort members in the editor121- **Limit members displayed**: Tune `maxNodeLimitInMemberEditor` for large hierarchies122- **OLAP member loading**: On-demand loading via `loadOnDemandInMemberEditor` and `levelCount`123- **Label filtering**: Filter header text by string (Equals, Contains, BeginWith, Between, ...), number, or date124- **Value filtering**: Filter by aggregated values with operators (Equals, GreaterThan, Between, ...) and **Top/Bottom N** members125- **Filtering events**: `memberFiltering`, `memberEditorOpen`, `actionBegin`/`actionComplete`/`actionFailure`126- Member sorting: Arrange field members in ascending/descending order127- Custom member sorting: Sort field members in user-defined order using `membersOrder`128- Value sorting: Sort pivot table values and aggregated data with `enableValueSorting`129- Programmatic value sorting: Configure with `valueSortSettings`130131### Data Formatting & Conditional Formatting132📄 **Read:** [references/data-formatting.md](references/data-formatting.md)133- Number formatting: Apply Currency (C), Percentage (P), Number (N), Scientific (E) formats134- Custom format strings: Define format strings with placeholders for calculated fields135- Conditional formatting: Apply colors/styles based on cell values using `conditionalFormatSettings`136- Format settings configuration: Configure in separate `formatSettings` array in `dataSourceSettings`137138### Export & Printing139📄 **Read:** [references/export-and-print.md](references/export-and-print.md)140- Excel export: `excelExport()` with custom properties, themes141- PDF export: `pdfExport()` with headers, footers, page orientation142- CSV export: `csvExport()` for large datasets (1M+ rows)143- Print functionality: `print()` method for table and chart144- Multi-table export: Combine multiple pivot tables in single file145- Export customization: Cell styling, color themes, branding146147### UI Customization148📄 **Read:** [references/ui-customization.md](references/ui-customization.md)149- Toolbar configuration: Show/hide built-in toolbar items150- Report management: New, Save, Load, Delete reports151- View switching: Toggle between Grid and Chart modes152- Export options: Quick export buttons153- Grand totals/Subtotals: Show/hide and customize positioning154- Custom templates: Build custom toolbar or field list155156### Grouping Bar UI Operations157📄 **Read:** [references/grouping-bar-ui-operations.md](references/grouping-bar-ui-operations.md)158- Enable grouping bar: Set `showGroupingBar: true` on component159- Drag-and-drop reorganization: Move fields between Row, Column, Value, Filter axes160- Filter operations: Access filters from grouping bar field buttons161- Sort operations: Configure sort options via grouping bar interface162- Remove operations: Remove fields directly from grouping bar163- Value field management: Switch between value fields in accumulation charts164- Hide specific icons: Control visibility of filter, sort, remove icons per field165- Grouping bar customization: Configure via `groupingBarSettings`166167### Tooltips Customization168📄 **Read:** [references/tooltips-customization.md](references/tooltips-customization.md)169- Enable/disable tooltips: Configure tooltip visibility on cells and charts170- Custom tooltip templates: Define dynamic tooltip content with placeholders171- Available placeholders: Row headers, column headers, value, and other cell metadata172- Pivot chart tooltip customization: Customize tooltip appearance for chart data points173- CSS styling: Style tooltip appearance with custom CSS174- Dynamic tooltip content: Configure based on cell values and context175176### Editing & Drill Operations177📄 **Read:** [references/editing-drill-operations.md](references/editing-drill-operations.md)178- Enable editing: Set `allowEditing: true` on component (relational data only)179- Edit modes: Normal (inline), Dialog (popup), Batch (multiple), Command Column (dedicated)180- Edit settings: Configure via `editSettings` with `allowAdding`, `allowDeleting`, `allowCommandColumns`181- Edit events: Monitor `editCompleted`, `actionBegin`, `actionComplete`, `actionFailure`182- CRUD operations: Create, Read, Update, Delete records via editing interface183- Drill-through operations: View raw underlying data for aggregated values via context menu184- Drill-down operations: Click cells to navigate hierarchical data deeper185- Cell selection: Configure via `selectionSettings`186- Save data: Updated records persist via event handlers and data binding187188### OLAP Data Sources189📄 **Read:** [references/olap-data-sources.md](references/olap-data-sources.md)190- Connection configuration: Set `url`, `catalog`, `cube`, `providerType: 'SSAS'` in dataSourceSettings191- OLAP cube elements: Measures (numeric aggregates), Dimensions (hierarchical groupings), Hierarchies, Named Sets192- MDX support: Configure using MDX (Multidimensional Expressions) syntax for queries193- Hierarchies: Access via `[Dimension].[Hierarchy]` notation (e.g., `[Date].[Date Hierarchy]`)194- Calculated fields: Create Calculated Measures and Dimensions in OLAP cubes195- Authentication: Configure via connection string or backend authentication headers196- Named sets: Predefined member groups for analysis197- Advanced features: Drill-down, virtual scrolling, value filtering with OLAP198199### Paging Configuration200📄 **Read:** [references/paging-configuration.md](references/paging-configuration.md)201- Enable paging with `enablePaging: true` and inject `PagerService`202- Page settings: `rowPageSize`, `columnPageSize`, `currentRowPage`, `currentColumnPage`203- Pager UI configuration and positioning (Top/Bottom)204- Row vs column paging205- Compact view and inverse pager layout206- Custom page size options in dropdown207- Paging with virtual scrolling for optimization208- Server-side paging for huge datasets209- Mobile-optimized paging210211### Virtual Scrolling212📄 **Read:** [references/virtual-scrolling.md](references/virtual-scrolling.md)213- Enable virtual scrolling with `enableVirtualization: true` for large datasets214- Single page mode: Use `allowSinglePage: true` to render only current view page215- Limitations: pixel-based columnWidth, avoid runtime sizing changes216- Static FieldList synchronization using `enginePopulated` events and `update`/`updateView` methods217- Performance optimization for 100K+ rows on client-side218219### Drill-Down & Drill-Through Operations220📄 **Read:** [references/drill-down.md](references/drill-down.md)221- Drill-down: Navigate hierarchical data by clicking cells222- Drill-up: Navigate back to higher levels223- Drill-through: View raw underlying data for aggregated values224- Events: `cellClick`, `fieldDrop`, `fieldsUpdated` for drill interactions225- Context menu: Built-in drill operations226227### Database Connections228📄 **Read:** [references/database-connections.md](references/database-connections.md)229- SQL Server: Connect via connection strings with SQL authentication230- MySQL: Configure with host, port, user, password, and database231- PostgreSQL: Connection configuration for PostgreSQL databases232- Oracle: Oracle database connectivity with named parameters233- MongoDB: Connect to MongoDB collections and query documents234- Elasticsearch: Big data analytics via Elasticsearch indices235- Snowflake: Cloud data warehouse integration236- Server-side processing: Use ASP.NET Core backend with database queries237238### Server-Side Pivot Engine239📄 **Read:** [references/server-side-pivot-engine.md](references/server-side-pivot-engine.md)240- Server-side aggregation: Delegate heavy processing to ASP.NET Core backend241- Client configuration: Set `mode: 'Server'` with `url` endpoint in dataSourceSettings242- ASP.NET Core setup: Download and configure PivotController with Syncfusion.Pivot.Engine NuGet243- Data sources: Support Collection, JSON, CSV, DataTable, Dynamic objects on server244- Large datasets: Handle 100K+ rows with server-side processing245- Virtual scrolling: Combine with server mode for optimal performance246- Export operations: Excel/CSV export of server-processed data247- Authentication: Configure via beforeServiceInvoke event or headers248249### Performance Optimization250📄 **Read:** [references/performance-optimization.md](references/performance-optimization.md)251- Virtual scrolling: Enable with `enableVirtualization: true` for 100K+ rows252- Single page mode: Use `allowSinglePage: true` for better performance253- Paging: Configure with `pageSettings` for row/column pagination254- Data compression: Enable `allowDataCompression: true` for duplicate record summarization255- Deferred updates: Use `allowDeferLayoutUpdate: true` to batch field operations256- Large dataset handling: Server-side processing with `mode: 'Server'`257- Best practices: Pre-filtering, optimized sorting, member filtering limits, avoiding built-in grouping258259### State Persistence & Hyperlinks260📄 **Read:** [references/state-persistence-hyperlinks.md](references/state-persistence-hyperlinks.md)261- State persistence: Save and restore pivot configuration using `getPersistData()`262- Local storage: Persist report state in browser localStorage for user sessions263- Report management: Save, load, and delete named reports264- JSON serialization: Export/import report configurations as JSON265- Hyperlinks: Enable clickable hyperlinks in pivot cells via `hyperlinkSettings`266- Hyperlink events: Handle hyperlink clicks with appropriate event handlers267- Drill-through hyperlinks: Links to detailed data sources for aggregates268269---270271## Quick Start Example272273```typescript274import { PivotViewAllModule, CalculatedFieldService } from '@syncfusion/ej2-angular-pivotview';275import { Component, OnInit, ViewChild } from '@angular/core';276import { PivotViewComponent, IDataSet } from '@syncfusion/ej2-angular-pivotview';277import { DataSourceSettingsModel } from '@syncfusion/ej2-pivotview/src/model/datasourcesettings-model';278279@Component({280 imports: [PivotViewAllModule],281 providers: [CalculatedFieldService],282 standalone: true,283 selector: 'app-pivot-grid',284 template: `285 <ejs-pivotview #pivotview id='PivotView' 286 [dataSourceSettings]="dataSourceSettings"287 [height]="'500px'"288 [width]="'100%'"289 [allowCalculatedField]="true" 290 [allowGrouping]="true"291 [toolbar]="toolbarItems">292 </ejs-pivotview>293 `294})295export class AppComponent implements OnInit {296 @ViewChild('pivotview') pivotViewComponent!: PivotViewComponent;297 298 public pivotData!: IDataSet[];299 public dataSourceSettings!: DataSourceSettingsModel;300 public toolbarItems: string[] = ['New', 'Save', 'SaveAs', 'Rename', 'Remove', 'Load', 'Export'];301302 ngOnInit(): void {303 this.pivotData = [304 { 'Sold': 31, 'Amount': 52824, 'Country': 'France', 'Products': 'Mountain Bikes', 'Year': 'FY 2015', 'Quarter': 'Q1' },305 { 'Sold': 51, 'Amount': 86904, 'Country': 'France', 'Products': 'Mountain Bikes', 'Year': 'FY 2015', 'Quarter': 'Q2' },306 { 'Sold': 90, 'Amount': 153360, 'Country': 'France', 'Products': 'Mountain Bikes', 'Year': 'FY 2015', 'Quarter': 'Q3' },307 { 'Sold': 25, 'Amount': 42500, 'Country': 'France', 'Products': 'Road Bikes', 'Year': 'FY 2015', 'Quarter': 'Q1' },308 { 'Sold': 40, 'Amount': 68000, 'Country': 'Germany', 'Products': 'Mountain Bikes', 'Year': 'FY 2015', 'Quarter': 'Q2' }309 ];310311 this.dataSourceSettings = {312 dataSource: this.pivotData,313 expandAll: false,314 rows: [{ name: 'Country' }, { name: 'Products' }],315 columns: [{ name: 'Year' }, { name: 'Quarter' }],316 values: [317 { name: 'AvgAmount', type: 'CalculatedField' },318 { name: 'Sold', type: 'Count' }319 ],320 calculatedFieldSettings: [321 {322 name: 'AvgAmount',323 formula: '"Sum(Amount)"/"Count(Sold)"' // Calculated field: Average324 }325 ],326 formatSettings: [327 { name: 'Amount', format: 'C2' }, // Currency format328 { name: 'AvgAmount', format: 'C2' } // Format calculated field329 ]330 };331 }332}333```334335---336337## Common Patterns338339### Pattern 1: Multiple Fields with Different Aggregation Types340Each field supports only ONE aggregation type. To analyze different aspects, use different fields with their respective aggregation functions:341```typescript342values: [343 { name: 'Amount', type: 'Sum' }, // Total sales amount344 { name: 'Quantity', type: 'Avg' }, // Average quantity sold345 { name: 'Sold', type: 'Count' }, // Number of transactions346 { name: 'Price', type: 'Min' }, // Minimum price347]348```349**Note:** Each field in the values array can only have ONE type. To get multiple aggregation types for analysis, use different fields or create calculated fields combining aggregations.350351### Pattern 2: Hierarchical Grouping352Organize data with multi-level grouping:353```typescript354rows: [355 { name: 'Country' }, // Primary level356 { name: 'Region' }, // Secondary level357 { name: 'City' } // Tertiary level358],359columns: [360 { name: 'Year' }, // Year level361 { name: 'Quarter' } // Quarter level362]363```364365### Pattern 3: Using Calculated Fields with Aggregations366Combine calculated fields with multiple aggregation types for advanced analysis:367```typescript368values: [369 { name: 'Amount', type: 'Sum' }, // Total amount370 { name: 'Quantity', type: 'Avg' }, // Average quantity371 { name: 'AvgRevenue', type: 'CalculatedField' } // Custom calculation372],373calculatedFieldSettings: [374 {375 name: 'AvgRevenue',376 formula: '"Sum(Amount)" / "Count(Quantity)"' // Revenue per unit377 }378],379formatSettings: [380 { name: 'Amount', format: 'C2' }, // Currency format for Amount381 { name: 'AvgRevenue', format: 'C2' } // Currency format for calculated field382]383```384385### Pattern 4: Number Range Grouping386Group numeric fields into ranges:387```typescript388groupSettings: [389 {390 name: 'ProductID',391 type: 'Number',392 rangeInterval: 5,393 startingAt: 1000,394 endingAt: 1010395 }396]397```398399### Pattern 5: Date Hierarchy Grouping400Organize dates with time-based hierarchies:401```typescript402groupSettings: [403 {404 name: 'OrderDate',405 type: 'Date',406 groupInterval: ['Years', 'Months'], // Year then month hierarchy407 startingAt: new Date(2020, 0, 1),408 endingAt: new Date(2023, 11, 31)409 }410]411```412413---414415## Key Configuration Properties416417| Property | Type | Location | Purpose |418|----------|------|----------|---------|419| `rows` | Array | `dataSourceSettings` | Fields organized vertically for grouping data |420| `columns` | Array | `dataSourceSettings` | Fields organized horizontally for grouping data |421| `values` | Array | `dataSourceSettings` | Fields to aggregate with `type` (Sum, Avg, Count, CalculatedField, etc.) |422| `filters` | Array | `dataSourceSettings` | Fields used to filter data across both axes |423| `type` | String | `values` field | Aggregation type: Sum, Avg, Count, Min, Max, Product, DistinctCount, Median, RunningTotals, **PercentageOfRunningTotals** (client-side only), DifferenceFrom, PercentageOfDifferenceFrom, PercentageOfGrandTotal, PercentageOfColumnTotal, PercentageOfRowTotal, PercentageOfParentTotal, **PercentageOfParentColumnTotal**, **PercentageOfParentRowTotal**, PopulationStDev, SampleStDev, PopulationVar, SampleVar, Index, CalculatedField |424| `baseField` | String | `values` field | Field reference for DifferenceFrom/Percentage-based comparisons (base field aggregation) |425| `baseItem` | String | `values` field | Specific member for base field comparisons |426| `allowCalculatedField` | Boolean | Component | Enable calculated field feature (requires CalculatedFieldService provider) |427| `calculatedFieldSettings` | Array | `dataSourceSettings` | Define calculated field `name` and `formula` properties |428| `formula` | String | `calculatedFieldSettings` | Mathematical expression using aggregation functions (Sum, Count, Avg, Min, Max) and operators (+, -, *, /, ^, <, >, ==, !=, &, \|, ?) |429| `formatSettings` | Array | `dataSourceSettings` | SEPARATE array for number formatting (C, N, P, E) of value fields and calculated fields |430| `allowGrouping` | Boolean | Component | Enable grouping feature (requires GroupingService provider) |431| `groupSettings` | Array | `dataSourceSettings` | Configure number, date, or custom grouping with `name`, `type`, `rangeInterval`, `groupInterval` |432| `groupInterval` | Array | `groupSettings` | Grouping hierarchy (Years, Quarters, Months, Days, Hours, Minutes, Seconds) |433| `aggregateTypes` | Array | Component | Restrict aggregation dropdown to specific types (array of AggregateTypes) |434| `showAggregationOnValueField` | Boolean | `dataSourceSettings` | Display aggregation type in grouping bar button text (e.g., "Sum of Amount" vs "Amount") |435| `sortSettings` | Array | `dataSourceSettings` | Configure field sorting with `order`, `membersOrder`, `name` properties |436| `enableValueSorting` | Boolean | Component | Enable sorting by aggregated values |437| `allowMemberFilter` | Boolean | `dataSourceSettings` | Enable/disable member filter UI (default `true`) |438| `allowLabelFilter` | Boolean | `dataSourceSettings` | Enable label filter UI for header text/number/date filtering |439| `allowValueFilter` | Boolean | `dataSourceSettings` | Enable value filter UI for aggregate-based filtering |440| `filterSettings` | Array | `dataSourceSettings` | Programmatic filter criteria with `name`, `type` (Include/Exclude/Label/Number/Date/Value), `condition`, `value1`, `value2`, `measure`, `items`, `levelCount`, `selectedField` |441| `condition` (Top/Bottom) | String | `filterSettings` (`type: 'Value'`) | Top/Bottom N members by aggregated value of the chosen `measure` (client-side only) |442| `maxNodeLimitInMemberEditor` | Number | Component | Max members shown in the Member Editor before showing a "more items" message (default `1000`) |443| `loadOnDemandInMemberEditor` | Boolean | Component | OLAP-only: load only the first hierarchy level until expansion/level-select (default `true`) |444445**Important**: When adding calculated fields to values, use `type: 'CalculatedField'` to distinguish them from regular aggregations. Format settings must be applied in a separate `formatSettings` array, not within the value field object.446447---448449## Next Steps450451**Foundation (Start here):**4521. Read **Getting Started** for setup and initialization4532. Read **Aggregation** to implement aggregation functions and base field aggregations4543. Read **Grouping** to configure number, date, and custom grouping455456**Data Manipulation:**4574. Read **Calculated Fields** for complex calculations and custom field formulas4585. Read **Filtering & Sorting** for label/value filtering and custom sorting4596. Read **Data Formatting** for number formats and conditional formatting460461**Visualization & Interaction:**4627. Read **Pivot Chart Integration** for charting and drill operations4638. Read **UI Customization** for toolbars and custom interfaces4649. Read **Drill-Down & Drill-Through** for hierarchical data exploration465466**Advanced Features:**46710. Read **Export & Printing** for multi-format export (Excel, PDF, CSV)46811. Read **State Persistence** for saving and restoring configurations46912. Read **Database Connections** for SQL/NoSQL/big data integration47013. Read **Server-Side Pivot Engine** for processing 100K+ rows on backend47114. Read **Performance Optimization** for large datasets, deferred updates, and virtual scrolling472473---474475## Foundational References476477These files provide foundational knowledge and may be referenced by feature guides:478479📄 **[references/core-concepts.md](references/core-concepts.md)** - Data binding types (JSON, CSV, OLAP), client-side vs server-side comparison, choosing appropriate data sources480481📄 **[references/layout-and-columns.md](references/layout-and-columns.md)** - Classic layout, row/column sizing, column features, cell selection and customization482483📄 **[references/field-list.md](references/field-list.md)** - Field list UI (popup/fixed modes), field organization, deferred updates patterns