This sample demonstrates how to create and configure a Pivot Table using Syncfusion's React PivotView component, including features like calculated fields, field list, and basic data binding.
The Syncfusion Pivot Table (PivotView) is a powerful React component for analyzing and summarizing large datasets. In this example:
- A sample dataset is used with fields such as
Country,Products,Year,Quarter,Sold, andAmount. - The Pivot Table is configured with:
- Rows:
Country,Products - Columns:
Year - Values:
Sold(Units Sold),Amount(Sold Amount), and a Calculated FieldTotal(Sum of Sold and Amount) - Filters:
Quarter
- Rows:
- A Calculated Field named
Totalis added using the formula:"Sum(Amount)" + "Sum(Sold)". - The Field List and Calculated Field features are enabled for interactive configuration.
-
Calculated Fields:
Easily create custom calculations using existing data fields.calculatedFieldSettings: [{ name: "Total", formula: '"Sum(Amount)"+"Sum(Sold)"' }]
-
Field List:
Allows users to dynamically modify the Pivot Table layout. -
Responsive Layout:
The Pivot Table adjusts to fit the container width and height.
Before running this project, ensure you have the following installed:
- Node.js (latest version recommended)
- Visual Studio Code
Follow these steps to run the application:
-
Clone the repository:
git clone https://github.com/SyncfusionExamples/create-a-react-pivot-table
-
Navigate to the project folder:
cd create-a-react-pivot-table -
Install dependencies:
npm install
-
Start the development server:
npm start
-
Open your browser and go to
http://localhost:3000to view the Pivot Table.
create-a-react-pivot-table/
├── public/
│ ├── index.html
│ └── ...
├── src/
│ ├── App.tsx # Main component with Pivot Table configuration
│ ├── data.js # Sample data used in the Pivot Table
│ └── ...
├── package.json
├── README.md
└── tsconfig.json
For questions or feedback, visit:
This project uses Syncfusion components, which require a valid license for production use.
View Syncfusion License Terms