API 参考

FSlideChart

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

The facade class for a slide chart element.

Access

Access through:

Inheritance

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

Setup

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

@univerjs-pro/slides-chart

FSlideChart.getChartData

Get read-only chart resource data stored in the presentation snapshot. Use getInfo() for the complete insertion snapshot. toBuilder() creates a detached copy Builder and does not update this Chart.

TypeScript
getChartData(): { chart: IChartResourceSnapshot; dataSource: IChartResourceDataSource; } | null

Returns

The chart resource data, or null when it does not exist.

Examples

TypeScript
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideById('slide-1')const charts = fSlide.getCharts()// Get the chart resource data of the first chart.const chart = charts[0]const chartData = chart.getChartData()console.log(chartData)

Types: IChartResourceSnapshot · IChartResourceDataSource

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

FSlideChart.getElementId

Returns the stable Slide element identifier that hosts this Chart.

TypeScript
getElementId(): string

Returns

The Slide element identifier.

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

FSlideChart.getPlaceholder

Get the placeholder metadata associated with this chart.

TypeScript
getPlaceholder(): ISlidePlaceholderData | undefined

Returns

The placeholder metadata, or undefined if the chart is not created from a placeholder.

Examples

TypeScript
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideById('slide-1')const charts = fSlide.getCharts()console.log(charts[0].getPlaceholder())

Types: ISlidePlaceholderData

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

FSlideChart.getStroke

Get the chart frame stroke style.

TypeScript
getStroke(): IShapeLineStyle | undefined

Returns

The chart frame stroke style.

Examples

TypeScript
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideById('slide-1')const charts = fSlide.getCharts()console.log(charts[0].getStroke())

Types: IShapeLineStyle

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

FSlideChart.setPlaceholder

Update the placeholder metadata associated with this chart.

TypeScript
setPlaceholder(placeholder?: ISlidePlaceholderData): this

Parameters

  • placeholder — Optional. The placeholder metadata. Pass undefined to clear it.

Returns

This chart, for chaining.

Examples

TypeScript
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideById('slide-1')const charts = fSlide.getCharts()// Clear the placeholder of the first chart.const chart = charts[0]chart.setPlaceholder(undefined)

Types: ISlidePlaceholderData

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

FSlideChart.setStroke

Update the chart frame stroke style.

TypeScript
setStroke(stroke?: IShapeLineStyle): this

Parameters

  • stroke — Optional. The stroke style. Pass undefined to clear it.

Returns

This chart, for chaining.

Examples

TypeScript
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideById('slide-1')const charts = fSlide.getCharts()// Set the stroke of the first chart to a gray thin line.const chart = charts[0]chart.setStroke({ color: '#d1d5db', width: 1 })

Types: IShapeLineStyle

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

FSlideChart.unitId

TypeScript
readonly unitId: string

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

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.