API 参考

FBoardChart

本 API 页面目前提供英文正文。代码签名与标识符不随界面语言变化。

Live facade for an inserted Board Chart element.

Use the inherited shortcut methods to update one property immediately. Use toBuilder() when several properties should be changed together, then pass the built Board Chart information to update().

Access

Access through:

Inheritance

Extends FChart. Its inherited members are available on this object.

Example

TypeScript
const fBoard = univerAPI.getActiveBoard()const chartInfo = fBoard  .newChart(univerAPI.Enum.ChartTypeString.Column)  .setSource([    ['Quarter', 'Sales'],    ['Q1', 120],    ['Q2', 180],  ])  .setAbsolutePosition(120, 80)  .setSize(640, 360)  .setTitle('Quarterly sales')  .build()const fChart = await fBoard.insertChart(chartInfo)fChart.setSubtitle('FY 2026').setAbsolutePosition(160, 100).setSize(720, 400)await fChart.setDataSource([  ['Quarter', 'Sales'],  ['Q3', 210],  ['Q4', 260],])const updatedInfo = fChart  .toBuilder(univerAPI.Enum.ChartTypeString.Pie)  .setTitle('Second-half sales')  .setDoughnutHole(0.4)  .build()await fChart.update(updatedInfo)

Setup

Register @univerjs-pro/boards-chart or a preset that includes it. In plugin mode, import @univerjs-pro/boards-chart/facade. Additional methods below require their listed plugin packages. See Facade setup.

@univerjs-pro/boards-chart

FBoardChart.chartId

The stable Chart resource identifier.

TypeScript
readonly chartId: string

Package: @univerjs-pro/boards-chart · Type definitions

FBoardChart.elementId

The stable Board element identifier that hosts this Chart.

TypeScript
readonly elementId: string

Package: @univerjs-pro/boards-chart · Type definitions

FBoardChart.getChart

Returns the current Chart resource snapshot stored by the Board.

TypeScript
getChart(): IChartResourceSnapshot | null

Returns

The Chart resource, or null if it no longer exists.

Examples

TypeScript
const fBoard = univerAPI.getActiveBoard()const fChart = fBoard.getCharts()[0]console.log(fChart?.getChart())

Types: IChartResourceSnapshot

Package: @univerjs-pro/boards-chart · Type definitions

FBoardChart.getDataSource

Returns the current Chart data-source resource stored by the Board.

TypeScript
getDataSource(): IChartResourceDataSource | null

Returns

The data-source resource, or null if it no longer exists.

Examples

TypeScript
const fBoard = univerAPI.getActiveBoard()const fChart = fBoard.getCharts()[0]console.log(fChart?.getDataSource())

Types: IChartResourceDataSource

Package: @univerjs-pro/boards-chart · Type definitions

FBoardChart.getElement

Returns the current Board Chart element snapshot.

TypeScript
getElement(): IBoardChartElement | null

Returns

The Chart element, or null if it no longer exists.

Examples

TypeScript
const fBoard = univerAPI.getActiveBoard()const fChart = fBoard.getCharts()[0]console.log(fChart?.getElement())

Types: IBoardChartElement

Package: @univerjs-pro/boards-chart · Type definitions

FBoardChart.getElementId

Returns the stable Board element identifier that hosts this Chart.

TypeScript
getElementId(): string

Returns

The Board element identifier.

Examples

TypeScript
const fBoard = univerAPI.getActiveBoard()const fChart = fBoard.getCharts()[0]console.log(fChart?.getElementId())

Package: @univerjs-pro/boards-chart · Type definitions

FBoardChart.unitId

The identifier of the Board that owns this Chart.

TypeScript
readonly unitId: string

Package: @univerjs-pro/boards-chart · Type definitions

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.