FBoardChart
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
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.
readonly chartId: stringPackage: @univerjs-pro/boards-chart · Type definitions
FBoardChart.elementId
The stable Board element identifier that hosts this Chart.
readonly elementId: stringPackage: @univerjs-pro/boards-chart · Type definitions
FBoardChart.getChart
Returns the current Chart resource snapshot stored by the Board.
getChart(): IChartResourceSnapshot | nullReturns
The Chart resource, or null if it no longer exists.
Examples
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.
getDataSource(): IChartResourceDataSource | nullReturns
The data-source resource, or null if it no longer exists.
Examples
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.
getElement(): IBoardChartElement | nullReturns
The Chart element, or null if it no longer exists.
Examples
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.
getElementId(): stringReturns
The Board element identifier.
Examples
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.
readonly unitId: stringPackage: @univerjs-pro/boards-chart · Type definitions
How is this guide?