FSlideChart
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.
getChartData(): { chart: IChartResourceSnapshot; dataSource: IChartResourceDataSource; } | nullReturns
The chart resource data, or null when it does not exist.
Examples
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.
getElementId(): stringReturns
The Slide element identifier.
Package: @univerjs-pro/slides-chart · Type definitions
FSlideChart.getPlaceholder
Get the placeholder metadata associated with this chart.
getPlaceholder(): ISlidePlaceholderData | undefinedReturns
The placeholder metadata, or undefined if the chart is not created from a placeholder.
Examples
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.
getStroke(): IShapeLineStyle | undefinedReturns
The chart frame stroke style.
Examples
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.
setPlaceholder(placeholder?: ISlidePlaceholderData): thisParameters
placeholder— Optional. The placeholder metadata. Passundefinedto clear it.
Returns
This chart, for chaining.
Examples
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.
setStroke(stroke?: IShapeLineStyle): thisParameters
stroke— Optional. The stroke style. Passundefinedto clear it.
Returns
This chart, for chaining.
Examples
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
readonly unitId: stringPackage: @univerjs-pro/slides-chart · Type definitions
你觉得这篇文档如何?