# @univerjs-pro/sheets-pivot-chart

> Language fallback: requested `zh-CN`; content is `en-US`.

- Human documentation: [https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/sheets-pivot-chart](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/sheets-pivot-chart)

- Agent Markdown: [https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/sheets-pivot-chart.md](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/sheets-pivot-chart.md)

- Requested language: `zh-CN`

- Content language: `en-US`

- Documentation version: `1.0.0`

- Source: [packages/plugins/univerjs-pro/sheets-pivot-chart.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/packages/plugins/univerjs-pro/sheets-pivot-chart.mdx)

---

Sheets PivotChart model, commands, calculation, drawing binding, and Facade APIs. Register after the Sheets PivotTable and chart plugins.

```ts
import { UniverSheetsPivotChartPlugin } from '@univerjs-pro/sheets-pivot-chart'

import '@univerjs-pro/sheets-pivot-chart/facade'

univer.registerPlugin(UniverSheetsPivotChartPlugin)
```

Add [`@univerjs-pro/sheets-pivot-chart-ui`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/sheets-pivot-chart-ui.md) for insertion and field panels. The advanced Sheets preset includes both plugins. Import the PivotChart Facade entry explicitly when calling its APIs.

## Data ownership

* `worksheet.newPivotChart(type).setSource(range)` creates an independent report.
* `pivotTable.newChart(type)` creates a chart linked to an existing PivotTable. Field edits update the shared report; chart appearance and placement remain independent.
* Removing a linked chart leaves its PivotTable intact. Removing the PivotTable makes the chart unavailable until that same table is restored.

See [`FSheetPivotChart`](https://docs.univer.ai/zh-CN/reference/facade/sheet-pivot-chart.md) and the [PivotChart guide](https://docs.univer.ai/zh-CN/guides/sheets/features/pivot-chart.md).

## Worker calculation

`IUniverSheetsPivotChartConfig.notExecuteFormula` disables calculation on the main thread. Set it to `true` together with the PivotTable plugin's option when using a Worker. Register `UniverSheetsPivotChartWorkerPlugin` in the Worker alongside its RPC, formula, license, and PivotTable setup. Drawing and chart bindings belong on the main thread.

`UniverSheetsAdvancedPreset({ useWorker: true })` and `UniverSheetsAdvancedWorkerPreset()` configure this split. See the [Worker guide](https://docs.univer.ai/zh-CN/guides/sheets/getting-started/worker.md).

This model package has no stylesheet or locales.

## Lifecycle events

Subscribe with `univerAPI.addEvent(univerAPI.Event.PivotChartAdded, callback)` and dispose the returned subscription when the consumer is removed. All events identify the workbook, worksheet, and chart with `unitId`, `subUnitId`, and `pivotChartId`.

| Event                        | Meaning                                                                                                 |
| ---------------------------- | ------------------------------------------------------------------------------------------------------- |
| `PivotChartAdded`            | A PivotChart definition was added.                                                                      |
| `PivotChartRemoved`          | A PivotChart definition was removed.                                                                    |
| `PivotChartChanged`          | The definition or its drawing changed; inspect `kind` to distinguish them.                              |
| `PivotChartRendered`         | A calculation result was delivered to the chart runtime. This is not a browser paint-completion signal. |
| `PivotChartDataStateChanged` | The calculation runtime state changed.                                                                  |

See the [event payloads](https://docs.univer.ai/zh-CN/reference/facade/events.md#pivotchartadded).
