# FBasePivotView

- Human documentation: [https://docs.univer.ai/reference/facade/base-pivot-view](https://docs.univer.ai/reference/facade/base-pivot-view)

- Agent Markdown: [https://docs.univer.ai/reference/facade/base-pivot-view.md](https://docs.univer.ai/reference/facade/base-pivot-view.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [facade/base-pivot-view.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/facade/base-pivot-view.mdx)

---

Facade API object bound to one Base Pivot View.

## Access

Access through:

* [`FBase.getPivotViews()`](https://docs.univer.ai/reference/facade/base.md#getpivotviews)
* [`FBase.getPivotView()`](https://docs.univer.ai/reference/facade/base.md#getpivotview)
* [`FBase.createPivotView()`](https://docs.univer.ai/reference/facade/base.md#createpivotview)

## Setup

Register [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) or a preset that includes it. In plugin mode, import `@univerjs-pro/bases-dashboard/facade`. Additional methods below require their listed plugin packages. See [Facade setup](https://docs.univer.ai/guides/bases/getting-started/facade.md).

## `@univerjs-pro/bases-dashboard`

### `FBasePivotView.calculate`

Calculates the Pivot View, optionally applying Dashboard or caller-owned table filters.

```typescript
calculate(filters?: Array<IFilterConfig | null>): Promise<IBasePivotCalculationResult>
```

**Parameters**

* `filters` — Optional. Default: `[]`. Additional Base table filters applied before Pivot calculation.

**Returns**

Engine Pivot layout result suitable for rendering or Chart adaptation.

**Examples**

```ts
const result = await pivotView.calculate()
console.log(result.view.dataView)
```

**Types:** [`IBasePivotCalculationResult`](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/types.d.ts) · [`Promise`](https://unpkg.com/@typescript/typescript-darwin-arm64@7.0.2/lib/lib.es5.d.ts) · [`Array`](https://unpkg.com/@typescript/typescript-darwin-arm64@7.0.2/lib/lib.es5.d.ts) · [`IFilterConfig`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.delete`

Deletes this Pivot View through the command system.

```typescript
delete(): boolean
```

**Returns**

Whether the command succeeded.

**Examples**

```ts
pivotView.delete()
```

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.getConfig`

Returns a detached Pivot and Chart configuration snapshot.

```typescript
getConfig(): IBasePivotViewConfig
```

**Returns**

Current Pivot View configuration.

**Examples**

```ts
const config = pivotView.getConfig()
```

**Types:** [`IBasePivotViewConfig`](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/types.d.ts)

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.getId`

Returns the stable Pivot View id.

```typescript
getId(): string
```

**Returns**

Stable Pivot View id.

**Examples**

```ts
const viewId = pivotView.getId()
```

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.getName`

Returns the human-readable Pivot View name.

```typescript
getName(): string
```

**Returns**

Pivot View name.

**Examples**

```ts
const name = pivotView.getName()
```

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.getPermission`

Returns the Pivot View object permission facade.

`canEdit()` combines the Base unit, parent Table, and Pivot View Edit points. Enabling the
Pivot View does not override a read-only Base or Table.

```typescript
getPermission(): FBaseObjectPermission
```

**Returns**

Permission facade for this Pivot View.

**Examples**

Make one Pivot View read-only and restore it

```ts
const base = univerAPI.getActiveBase()
const table = base?.getTables()[0]
const pivot = table ? base?.getPivotViews(table.getId())[0] : undefined
if (!pivot) throw new Error('Pivot View not found.')

await pivot.getPermission().setReadOnly()
console.log(pivot.getPermission().canEdit()) // false
await pivot.getPermission().setEditable()
```

**Types:** [`FBaseObjectPermission`](https://docs.univer.ai/reference/facade/base-object-permission.md)

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.getPivotTable`

Creates a detached `engine-pivot` model initialized from this Pivot View.

Mutating the returned model does not change the Base. After using Engine methods such as
`addFieldWithSourceId()`, persist the result with `updateConfig({ pivot: pivotTable.toJSON() })`.

```typescript
getPivotTable(): PivotTable
```

**Returns**

Detached Engine Pivot model backed by the current table fields.

**Examples**

```ts
import { PivotTableFiledAreaEnum } from '@univerjs-pro/engine-pivot'

const pivotTable = pivotView.getPivotTable()
pivotTable.addFieldWithSourceId('region', PivotTableFiledAreaEnum.Row)
pivotTable.addFieldWithSourceId('revenue', PivotTableFiledAreaEnum.Value)
pivotView.updateConfig({ pivot: pivotTable.toJSON() })
```

**Types:** [`PivotTable`](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.getSnapshot`

Returns a detached Pivot View snapshot.

```typescript
getSnapshot(): IBasePivotViewSnapshot
```

**Returns**

Snapshot safe for local inspection or editing.

**Throws**

If the Pivot View has been deleted or changed to another view type.

**Examples**

```ts
const snapshot = pivotView.getSnapshot()
```

**Types:** [`IBasePivotViewSnapshot`](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/types.d.ts)

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.getTableId`

Returns the stable source table id.

```typescript
getTableId(): string
```

**Returns**

Stable source table id.

**Examples**

```ts
const tableId = pivotView.getTableId()
```

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.setName`

Renames the Pivot View through the command system.

```typescript
setName(name: string): boolean
```

**Parameters**

* `name` — Required. New human-readable Pivot View name.

**Returns**

Whether the command succeeded.

**Examples**

```ts
pivotView.setName('Revenue by market')
```

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)

### `FBasePivotView.updateConfig`

Partially updates the Pivot View through the command system, including undo and redo support.

Top-level properties are replaced. Merge nested `chart` properties with the current Chart config
before passing them when only one Chart property should change.

```typescript
updateConfig(patch: Partial<IBasePivotViewConfig>): boolean
```

**Parameters**

* `patch` — Required. Top-level Pivot View configuration patch.

**Returns**

Whether the command succeeded.

**Examples**

```ts
import { ChartTypeBits } from '@univerjs-pro/engine-chart'

const current = pivotView.getConfig()
pivotView.updateConfig({
  chart: { ...current.chart, type: ChartTypeBits.Line },
  displayMode: 'chart',
})
```

**Types:** [`Partial`](https://unpkg.com/@typescript/typescript-darwin-arm64@7.0.2/lib/lib.es5.d.ts) · [`IBasePivotViewConfig`](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/types.d.ts)

**Package:** [`@univerjs-pro/bases-dashboard`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/bases-dashboard.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases-dashboard@1.0.0-rc.0/lib/types/facade/f-base-pivot-view.d.ts)
