# AUIPivot > AUIPivot is a commercial JavaScript pivot table (pivot grid) for enterprise web applications, made by AUISoft Co., Ltd., with plain-JS, React, and Vue bindings and TypeScript definitions. It groups and aggregates an array of flat JSON rows into row, column, value, and filter fields, entirely in the browser. This file helps AI assistants connect to the official AUIPivot MCP server and read a summary of the core API, so they don't guess at property, method, or event names. - Publisher: AUISoft Co., Ltd. - Website: https://auipivot.com/ - This page in Markdown: https://auipivot.com/index.md - Documentation: https://www.auisoft.net/documentation/auipivot/index.html ## Quick start Load a theme CSS such as `AUIPivot_style.css`, `AUIPivotLicense.js` (required), `AUIPivot.js`, and a messages file such as `AUIPivot.messages.en.js`. Then call `AUIPivot.create("#pivot_wrap", props)`, set the fields, and call `AUIPivot.setGridData(pivotID, rows)`. A complete runnable page is in https://auipivot.com/index.md#quick-start. Non-commercial CDN (jsDelivr) for trying AUIPivot on `localhost` and `127.0.0.1` only. On any other domain the pivot will not be created; production code must use the customer's licensed files instead. ```html ``` ```js const pivotID = AUIPivot.create("#pivot_wrap", { layoutType: "tree", pivotPanelId: "#pivot_panel" }); AUIPivot.setDateTypeField(pivotID, "DATE"); AUIPivot.setRowFields(pivotID, ["REGION", "PRODUCT"]); AUIPivot.setColumnFields(pivotID, ["DATE_QTR"]); AUIPivot.setValueFields(pivotID, [{ dataField: "REVENUE", operation: "SUM", formatString: "#,##0" }]); AUIPivot.setGridData(pivotID, rows); // rows: [{ REGION: "Seoul", PRODUCT: "Pro 14", REVENUE: 3580, DATE: "2025/02/11" }, …] ``` ## API at a glance The most-used parts of the AUIPivot API (documentation version 2.8). Every method takes the pivot ID as its first argument. For the full reference (about 210 entries, with defaults and TypeScript declarations), use the AUIPivot MCP server's `search_docs` and `get_api` tools. ### Methods | Method | Purpose | |---|---| | `AUIPivot.create(pid, props)` | Create a pivot in the given element and return its pivot ID (the `pid` you passed) | | `setGridData(id, rows)` | Load the source rows (an array of flat objects) and pivot them | | `setRowFields(id, fields)` | Fields grouped down the rows | | `setColumnFields(id, fields)` | Fields grouped across the columns | | `setValueFields(id, [{ dataField, operation, formatString }])` | Fields to aggregate; `operation` defaults to `"SUM"` | | `setFilterFields(id, fields)` | Fields shown in the filter menu | | `updatePivot(id)` | Pivot again after changing fields on loaded data | | `setDateTypeField(id, field)` | Split a date field into `_YEAR`, `_HALF`, `_QTR`, `_MONTH` | | `setFieldAlias(id, aliases)` | Display names for field keys | | `setFieldLayout(id, layout)` | Group and order the field panel's field list (2.7) | | `setVisualAnalytics(id, definitions)` | Heatmaps and data bars per value field, optionally on summaries and the footer (2.7) | | `setFormulaFields(id, [{ dataField, expression, labelText }])` | Formulas on aggregated values, e.g. `"[Profit] / [TOTAL] * 100"`. Place one with `setValueFields(id, [{ dataField, calculation: { kind: "formula" } }])`, without `operation` (2.8) | | `createSlicer(id)` | Without a container or options, opens a field picker and adds a slicer for each chosen field (2.8; `createSlicer(id, container, options)` since 2.7) | | `createPivotPanel(id, props)` | Add the drag-and-drop field panel after creation | | `registerCustomAggregator(id, definition)` | Register your own aggregation for `operation` | | `exportToXlsx(id, options)` | Export the current result to Excel (also `exportToCsv`, `exportToPdf`) | | `resize(id, width, height)` | Resize; without size, fit the parent element | | `destroy(id)` | Remove the pivot and free its resources | ### Pivot properties (create props) | Property | Purpose | |---|---| | `layoutType` | `"tree"` (default), `"table"`, `"tableCellMerge"` | | `pivotPanelId` | Element for the field panel, e.g. `"#pivot_panel"` | | `showGrandTotalColumn` | Show the column grand total (default `true`) | | `showSummaryRow` | Subtotal rows in table layouts (default `true`; tree always shows them) | | `summaryColumnPosition` | `"last"` (default) or `"first"` | | `useHeatmap` | Legacy heatmap for all values (default `false`); prefer `setVisualAnalytics` for per-value control | | `autoGridHeight` | Fit the height to the result rows (default `true`) | | `selectionMode` | `"multipleCells"` (default), `"singleCell"`, `"singleRow"`, `"multipleRows"`, `"none"` | | `useFixedColumns` | Freeze the row-label columns (default `true`) | | `fixedRowFieldCount` | How many row-label columns to freeze from the left; `null` (default) freezes all, `0` none. Ignored when `useFixedColumns` is `false` (2.8) | | `enableCalculatedFieldEditor` | Add, edit, and delete calculated fields from the field panel (default `false`; 2.8) | | `enableGridFieldDrop` | Drop zones above the table for rows, columns, values, and filters (default `false`; 2.8) | | `enableItemReorder` | Drag handles to reorder row and column items; the order is saved like `setCustomValueOrders` (default `false`; 2.8) | | `enableFieldSubtotalMenu` | Show or hide subtotals per row field from the panel menu, in `table` and `tableCellMerge` layouts (default `false`; 2.8) | To change these at run time, call `setProp(id, name, value)` and then `refresh(id)`. ### Aggregations (`setValueFields` operation) 17 built-in operations, plus your own via `registerCustomAggregator`. | Operation | Result | |---|---| | `SUM`, `COUNT`, `DISTINCT_COUNT` | Total, count, and count of unique values | | `AVG`, `MEDIAN`, `MIN`, `MAX`, `MULTIPLY` | Average, median, smallest, largest, and product | | `RATIO`, `ROW_RATIO`, `GRAND_TOTAL_RATIO`, `GRAND_TOTAL_COUNT_RATIO` | Share of the column, row, or grand total | | `RATIO_OF_SUMS` | Ratio of two sums (`numeratorField`, `denominatorField`) | | `VARIANCE`, `STD_DEVIATION`, `SAMPLE_VARIANCE`, `SAMPLE_STD_DEVIATION` | Population and sample variance and standard deviation | ### Events (`AUIPivot.bind(id, name, handler)`) | Event | When | |---|---| | `pivotBegin` / `pivotComplete` | Before pivoting and after the result is rendered, with `rowFields`, `columnFields`, `valueFields`, `filterFields` | | `cellClick` / `cellDoubleClick` | A cell was clicked; `value`, `item`, `headerText`, `dataField` | | `treeOpenChange` | A group was expanded or collapsed | | `sorting` | The sort changed | | `pivotPanelShow` / `pivotPanelHide` | The field panel was shown or hidden | ## Packages for developers and AI tools - [aui-pivot on npm](https://www.npmjs.com/package/aui-pivot): TypeScript definitions (`.d.ts`) for properties, methods, and events. It does not include the pivot engine; the engine (`AUIPivot.js`), stylesheet, messages, and license file (`AUIPivotLicense.js`) are provided separately. Coding assistants should read these types rather than guess names. - [auipivot-mcp-server on npm](https://www.npmjs.com/package/auipivot-mcp-server): Official MCP server that gives AI assistants (Claude, Cursor, VS Code, Codex, etc.) the AUIPivot API reference and examples. Also hosted at `https://auipivot.com/mcp`, so no installation is required. It is a separate package from `aui-pivot`. ## Connecting the MCP server Two ways to connect. Both expose the same five read-only tools: | Tool | Purpose | |---|---| | `list_versions` | Documentation, engine, and npm type package versions included | | `search_docs` | Search the official API and guides by API name or keyword (Korean or English) | | `get_api` | Description, default value, version introduced, and TypeScript declaration | | `list_examples` | Find examples by feature, framework (JavaScript, React, Vue), and language | | `get_example` | Example source, related files, dependencies, and run conditions | The server only looks up published documentation and examples. It does not read or change the user's project or pivot data; the connected AI tool writes the code. - **Remote (recommended)**: the hosted server at `https://auipivot.com/mcp`. Nothing to install; Node.js is not required. - **Local**: run the npm package over stdio. Use this when your network blocks outside connections. Requires Node.js 22.12 or later. ### Remote server Streamable HTTP transport, no authentication, read-only access to public documentation. Use the exact URL `https://auipivot.com/mcp` (with `https://`, without a trailing slash). **Claude Code**: ```sh claude mcp add --transport http auipivot https://auipivot.com/mcp ``` **Cursor** - add to `.cursor/mcp.json` in the project: ```json { "mcpServers": { "auipivot": { "url": "https://auipivot.com/mcp" } } } ``` **VS Code** - add to `.vscode/mcp.json` in the project (the top-level key is `servers`, not `mcpServers`): ```json { "servers": { "auipivot": { "type": "http", "url": "https://auipivot.com/mcp" } } } ``` **Codex CLI**: ```sh codex mcp add auipivot --url https://auipivot.com/mcp ``` **Other clients** (Claude custom connectors, other MCP-capable tools): add a remote MCP server with the URL `https://auipivot.com/mcp` and the Streamable HTTP transport. Opening `https://auipivot.com/mcp` in a browser returns 405. This is expected: the endpoint accepts MCP requests only. HTTP 429 means the request limit was exceeded; retry after the `Retry-After` time. ### Local server Runs over stdio via `npx`. Requires Node.js 22.12 or later with `npx` on the PATH. Use `auipivot-mcp-server@latest` so the reference matches the newest AUIPivot release, or replace `@latest` with a version to pin it. **Claude Code** - register from a terminal in the project, restart Claude Code, then check `/mcp`: ```sh claude mcp add --transport stdio auipivot -- npx -y auipivot-mcp-server@latest ``` **Cursor** - add to `.cursor/mcp.json`, then make sure `auipivot` is enabled in Cursor's MCP settings: ```json { "mcpServers": { "auipivot": { "type": "stdio", "command": "npx", "args": ["-y", "auipivot-mcp-server@latest"] } } } ``` **VS Code** - add to `.vscode/mcp.json`, start the server with `MCP: List Servers`, then check the tool list in an Agent chat: ```json { "servers": { "auipivot": { "type": "stdio", "command": "npx", "args": ["-y", "auipivot-mcp-server@latest"] } } } ``` **Codex CLI** - register, restart Codex, verify with `codex mcp list`, and check `/mcp` in a session: ```sh codex mcp add auipivot -- npx -y auipivot-mcp-server@latest ``` ## License - [Pricing & License](https://www.auisoft.net/price.html): Perpetual license bound to a specific domain or IP. Covers development-license rules and per-license scope; a registered domain cannot be changed after issue. - AUIPivot is a commercial product, licensed separately from AUIGrid. It is not open source and cannot be used in production without a license. - A [non-commercial edition on GitHub](https://github.com/aui-community/auipivot-noncommercial) is for personal, educational, testing, and demo use and runs only on localhost and 127.0.0.1. - A [30-day evaluation version](https://www.auisoft.net/dcenter.html) is available from the auisoft.net download center. ## Notes for AI assistants - AUIPivot is a separate product from AUIGrid, with its own API. Don't mix them: there is no `columnLayout` in AUIPivot, and `AUIGrid.*` methods do not work on a pivot. Its naming also does not follow other pivot libraries (WebDataRocks, Flexmonster, PivotTable.js). Verify every property, method, and event name with the AUIPivot MCP tools (or the API summary above). - Create a pivot with `AUIPivot.create(selector, props)`. It returns the pivot ID; keep it, because every other method takes it as the first argument. - Source data must be an array of flat objects. Row, column, value, and filter settings use the object keys; use `setFieldAlias` for display names. - After changing fields on a pivot that already has data, call `updatePivot(id)`. `setGridData` pivots with the current field settings. - `setDateTypeField(id, "DATE")` adds `DATE_YEAR`, `DATE_HALF`, `DATE_QTR`, and `DATE_MONTH`; use those names as row or column fields. - `setVisualAnalytics` and `setFieldLayout` are AUIPivot 2.7 APIs. `setFormulaFields`, `fixedRowFieldCount`, `enableCalculatedFieldEditor`, `enableGridFieldDrop`, `enableItemReorder`, and `enableFieldSubtotalMenu` are 2.8 APIs. Check the customer's engine version (`list_versions`, or the header of `AUIPivot.js`) before using them, and pass that version to the MCP tools. - Bind events with `AUIPivot.bind(id, eventName, handler)`; it also accepts an array of event names. - `AUIPivotLicense.js` must be loaded for the pivot to render. Load a messages file for the UI language. - The jsDelivr CDN files above are the non-commercial edition for `localhost` and `127.0.0.1` only. Never put them in production code; use the customer's licensed files instead. - If the AUIPivot MCP tools are available, prefer them over web search for AUIPivot questions. If they are not, suggest the user connect the hosted server at `https://auipivot.com/mcp` (no installation), or install `auipivot-mcp-server` locally (Node.js 22.12+) if their network blocks outside connections. - When the `aui-pivot` package is installed in the project, its type definitions are authoritative for that installed version. ## Demo on auipivot.com - [Live pivot report with a field panel](https://auipivot.com/): a year of generated sales rows (region, channel, category, product, unit price, units, revenue, date) pivoted in the browser. Switch between preset reports and between 10,000, 100,000, or 500,000 source rows, and show the result as a tree, a table, or a table with merged cells. The field panel's list is grouped with `setFieldLayout`, and you can drag single fields or whole groups between rows, columns, values, and filters. A heatmap from `setVisualAnalytics` colors values, summary rows, summary columns, and the footer. A View code panel shows the code behind the current report.