diff --git a/README.md b/README.md index 728c680..0165c8e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,511 @@ -# Getting Started with the Angular Pivot Table Component -A quick-start project that helps you to create and configure the Syncfusion Angular Pivot Table. This project also includes a code snippet to add required fields in the Angular Pivot Table and shows you how to add useful features like a grouping bar, filtering, formatting, Calculated field, Sorting and a field list. +# ๐ Getting Started โ Angular Pivot Table Component (Syncfusion EJ2) -Refer to the following documentation to learn about the Angular Pivot Table component: https://ej2.syncfusion.com/angular/documentation/pivotview/getting-started +[](https://www.syncfusion.com/content/downloads/syncfusion_license.pdf) +[](https://angular.io/) +[](https://www.syncfusion.com/angular-components/) +[](https://nodejs.org/) +[](https://www.npmjs.com/) -Check out this online example of the Blazor Pivot Table component: https://ej2.syncfusion.com/angular/demos/#/bootstrap5/pivot-table/default - -## Project prerequisites +> ๐ **Angular quick-start template** demonstrating Syncfusion EJ2 `PivotView` (Pivot Table) with **Field List**, **Grouping Bar**, **Calculated Fields**, **Formatting**, and **Sorting** โ includes sample data, CLI scripts, and production-ready configuration. -Make sure that you have the latest versions of NodeJS and Visual Studio Code in your machine before starting to work on this project. +> **๐บ Official Demo:** https://ej2.syncfusion.com/angular/demos/#/bootstrap5/pivot-table/default +> **๐ Official Documentation:** https://ej2.syncfusion.com/angular/documentation/pivotview/getting-started -## How to run this application? -To run this application, you need to clone the `Getting Started with the Angular Pivot Table Component` repository and then open it in Visual Studio Code. Now, simply install all the necessary angular packages into your current project using the `npm install` command and run your project using the `ng serve` command \ No newline at end of file +--- + +## ๐ Table of Contents + +- [๐ Overview](#-overview) +- [โจ Key Features](#-key-features) +- [๐งญ Quick Start](#-quick-start) +- [๐๏ธ Project Structure](#-project-structure) +- [๐จ Theming & Styling](#-theming--styling) +- [๐งฉ Minimal Example](#-minimal-example) +- [โ๏ธ Configuration & Customization](#-configuration--customization) +- [๐ค Contributing](#-contributing) +- [๐ License & Support](#-license--support) + +--- + +## ๐ Overview + +This repository provides a **production-ready starter template** for integrating Syncfusion's powerful `PivotView` (Pivot Table) component into your **Angular applications**. It demonstrates essential features including: + +- โ Interactive Pivot Table with drag-and-drop functionality +- โ Dynamic Field List for runtime field configuration +- โ Grouping Bar for intuitive data organization +- โ Calculated Fields for custom data computations +- โ Data Formatting (currency, percentages, etc.) +- โ Multi-level Sorting and Filtering +- โ Responsive Design with Tailwind CSS styling + +--- + +## โจ Key Features + +| Feature | Description | Benefit | +|---------|-------------|---------| +| ๐ฏ **Field List Interface** | Dynamically add, remove, and rearrange data fields at runtime | Empowers end-users to customize reports without code | +| ๐ **Grouping Bar** | Drag-and-drop fields between rows, columns, values, and filters | Intuitive data organization and real-time pivot manipulation | +| ๐งฎ **Calculated Fields** | Create custom formulas combining multiple data fields | Advanced data analysis and custom metrics | +| ๐ฑ **Data Formatting** | Display values in currency, percentages, and custom formats | Professional presentation of numerical data | +| โ๏ธ **Multi-Level Sorting** | Sort by multiple fields with ascending/descending control | Enhanced data exploration capabilities | +| ๐ **Advanced Filtering** | Filter by single or multiple criteria across all dimensions | Focused data analysis and drill-down exploration | +| ๐ฑ **Responsive Design** | Adapts seamlessly to desktop, tablet, and mobile screens | Universal accessibility across devices | +| ๐ **Server-Side Rendering (SSR)** | Full Angular SSR support out-of-the-box | SEO-friendly and faster initial page loads | +| โก **Ivy Compilation** | Modern Angular Ivy rendering engine | Smaller bundle sizes and improved performance | +| ๐จ **Theme Support** | Multiple Tailwind and Bootstrap themes available | Consistent branding and visual customization | + +--- + +## ๐ Quick Start + +### Prerequisites + +Ensure you have the following installed on your system: + +- **Node.js** (LTS version or higher) โ [Download](https://nodejs.org/) +- **npm** (v10+) โ Included with Node.js +- **Angular CLI** โ Install globally: `npm install -g @angular/cli` +- **Visual Studio Code** โ Optional but recommended โ [Download](https://code.visualstudio.com/) + +### Installation & Setup + +```bash +# 1๏ธโฃ Clone the repository +git clone https://github.com/SyncfusionExamples/getting-started-with-the-angular-pivot-table-component-in-angular-18.git + +# 2๏ธโฃ Navigate to the project directory +cd getting-started-with-the-angular-pivot-table-component-in-angular-18 + +# 3๏ธโฃ Install dependencies +npm install + +# 4๏ธโฃ Start the development server +npm start +``` + +**๐ Success!** Your application will open at `http://localhost:4200/` in your default browser. + +### Additional Commands + +```bash +# ๐จ Build for production +npm run build + +# ๐ Build and watch for changes (development) +npm run watch + +# ๐งช Run unit tests +npm test + +# ๐ Serve SSR version +npm run serve:ssr:my-app +``` + +--- + +## ๐๏ธ Project Structure + +``` +getting-started-with-the-angular-pivot-table-component-in-angular-18/ +โโโ ๐ angular.json # Angular CLI configuration +โโโ ๐ package.json # Project dependencies & scripts +โโโ ๐ tsconfig.json # TypeScript compilation config +โโโ ๐ tsconfig.app.json # App-specific TypeScript config +โโโ ๐ tsconfig.spec.json # Testing TypeScript config +โโโ ๐ server.ts # Express server for SSR +โโโ ๐ README.md # This file +โ +โโโ ๐ src/ +โ โโโ ๐ index.html # Main HTML entry point +โ โโโ ๐ main.ts # Angular bootstrap file +โ โโโ ๐ main.server.ts # SSR bootstrap file +โ โโโ ๐ styles.css # Global styles & Syncfusion CSS imports +โ โ +โ โโโ ๐ app/ +โ โโโ ๐ app.component.ts # Root component with PivotView +โ โโโ ๐ app.component.html # Component template (optional) +โ โโโ ๐ app.component.css # Component styles +โ โโโ ๐ app.component.spec.ts # Component unit tests +โ โโโ ๐ app.config.ts # Application-level config +โ โโโ ๐ app.config.server.ts # SSR-specific config +โ โโโ ๐ app.routes.ts # Application routing (if enabled) +โ โโโ ๐ datasource.ts # Sample data source +``` + +### Key Files Explained + +| File | Purpose | +|------|---------| +| `src/main.ts` | Angular application bootstrap entry point | +| `src/app/app.component.ts` | Root component containing PivotView logic | +| `src/styles.css` | Global styles and Syncfusion CSS imports | +| `package.json` | NPM dependencies (includes Syncfusion EJ2 packages) | +| `angular.json` | Angular CLI configuration for builds and dev server | + +--- + +## ๐จ Theming & Styling + +### Global CSS Imports (`src/styles.css`) + +Add Syncfusion theme CSS to your global styles: + +```css +/* Tailwind3 Theme (Modern) */ +@import '../node_modules/@syncfusion/ej2-base/styles/tailwind3.css'; +@import '../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css'; +@import '../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind3.css'; +@import '../node_modules/@syncfusion/ej2-grids/styles/tailwind3.css'; +@import '../node_modules/@syncfusion/ej2-inputs/styles/tailwind3.css'; +@import '../node_modules/@syncfusion/ej2-lists/styles/tailwind3.css'; +@import '../node_modules/@syncfusion/ej2-navigations/styles/tailwind3.css'; +@import '../node_modules/@syncfusion/ej2-popups/styles/tailwind3.css'; +@import '../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind3.css'; +@import '../node_modules/@syncfusion/ej2-angular-pivotview/styles/tailwind3.css'; +``` + +### Available Themes + +- ๐จ **tailwind3** โ Modern Tailwind CSS v3 design system +- ๐ข **bootstrap5** โ Bootstrap 5 professional styling +- ๐ **fluent2** โ Microsoft Fluent Design System +- ๐ **material3** โ Google Material Design 3 +- ๐ญ **fabric** โ Microsoft Fabric Design System + +**Swap themes** by replacing the CSS import path: + +```css +/* Switch to Bootstrap5 theme */ +@import '../node_modules/@syncfusion/ej2-angular-pivotview/styles/bootstrap5.css'; +``` + +--- + +## ๐งฉ Minimal Example + +### Component Implementation (`src/app/app.component.ts`) + +```typescript +import { Component, OnInit } from '@angular/core'; +import { PivotViewModule, PivotFieldListModule } from '@syncfusion/ej2-angular-pivotview'; +import { + IDataOptions, + IDataSet, + FieldListService, + CalculatedFieldService +} from '@syncfusion/ej2-angular-pivotview'; + +@Component({ + selector: 'app-root', + standalone: true, + imports: [PivotViewModule, PivotFieldListModule], + providers: [FieldListService, CalculatedFieldService], + template: ` +