# PivotConfig

> _Since v0.1.1_

Configuration for the pivot plugin.

Pivot mode transforms flat row data into a cross-tabulation (pivot table)
by grouping rows along one axis (`rowGroupFields`), spreading unique values
of another field across columns (`columnGroupFields`), and computing
aggregate values (`valueFields`) at each intersection.

#### Example

```typescript
new PivotPlugin({
  rowGroupFields: ['department'],
  columnGroupFields: ['quarter'],
  valueFields: [{ field: 'revenue', aggFunc: 'sum' }],
  showTotals: true,
  showGrandTotal: true,
})
```

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| `active?` | <code>boolean</code> | Whether pivot view is active on load (default: true when fields are configured) |
| `rowGroupFields?` | <code>string[]</code> | Fields to group rows by (vertical axis). Multiple fields create nested groups. |
| `columnGroupFields?` | <code>string[]</code> | Fields whose unique values become column headers (horizontal axis). |
| `valueFields?` | <code><a href="/grid/plugins/pivot/interfaces/pivotvaluefield/">PivotValueField</a>[]</code> | Value fields to aggregate at each row/column intersection. |
| `showTotals?` | <code>boolean</code> |  |
| `showGrandTotal?` | <code>boolean</code> |  |
| `defaultExpanded?` | <code><a href="/grid/plugins/pivot/types/pivotdefaultexpandedvalue/">PivotDefaultExpandedValue</a></code> | Which groups are expanded by default. - `true` — expand all (default) - `false` — collapse all - `number` — expand group at index - `string` — expand group with key - `string[]` — expand groups matching keys |
| `indentWidth?` | <code>number</code> | Indent width per depth level in pixels (default: 20) |
| `showToolPanel?` | <code>boolean</code> | Whether to show the pivot configuration tool panel (default: true) |
| `animation?` | <code><a href="/grid/api/core/types/expandcollapseanimation/">ExpandCollapseAnimation</a></code> | Animation style for expanding/collapsing groups. - `false`: No animation - `'slide'`: Slide animation (default) - `'fade'`: Fade animation |
| `sortRows?` | <code><a href="/grid/plugins/pivot/interfaces/pivotsortconfig/">PivotSortConfig</a></code> | Sort configuration for row groups. When set, groups at each level are sorted by label or aggregate value. |
| `sortColumns?` | <code><a href="/grid/plugins/pivot/types/pivotsortdir/">PivotSortDir</a></code> | Sort direction for column keys. Default: `'asc'` (alphabetical). Set to `'desc'` for reverse order. |
| `grandTotalInRowModel?` | <code>boolean</code> | Include the grand total row in the row model (so it's included in exports/copy). When `false` (default), grand total is rendered as a separate sticky footer. |
| `valueDisplayMode?` | <code><a href="/grid/plugins/pivot/types/pivotvaluedisplaymode/">PivotValueDisplayMode</a></code> | Display mode for aggregated values. |
| `showSubtotals?` | <code>boolean</code> | Whether to show subtotal rows at each group level in multi-level grouping. |

### Property Details

#### animation

**Default:** `'slide'`

---

#### grandTotalInRowModel

**Default:** `false`

---

#### valueDisplayMode

**Default:** `'raw'`

---

#### showSubtotals

**Default:** `false`

---
