@univerjs-pro/sheets-pivot-chart
Sheets PivotChart model, commands, calculation, drawing binding, and Facade APIs. Register after the Sheets PivotTable and chart plugins.
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 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 and the PivotChart guide.
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.
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.
How is this guide?