API 参考

FSunburstChartBuilder

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

Fluent semantic builder for an automatically laid-out Sunburst chart.

Field indexes are zero-based in the orientation-normalized dataset. Rendering needs at least one ordered hierarchy field and exactly one value field. Duplicate complete paths sum finite numeric values; sparse hierarchy values inherit within ancestor scope; parent facts add to child totals. Ring layout is automatic and root navigation is disabled.

Inheritance

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

Example

Sheet

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')const chartInfo = fWorksheet  .newChart(univerAPI.Enum.ChartTypeString.Sunburst)  .setSource('A1:D8')  .setHierarchyFields([0, 1, 2])  .setValueField(3)  .setSunburstLabel({    visible: true,    position: univerAPI.Enum.ChartSunburstLabelPosition.Outside,    color: '#334155',  })  .setCenterLabel({ visible: true, color: '#0f172a' })  .build()await fWorksheet.insertChart(chartInfo)

Doc

TypeScript
const fDocument = univerAPI.getActiveDocument()const chartInfo = fDocument  .newChart(univerAPI.Enum.ChartTypeString.Sunburst)  .setSource([    ['Region', 'Country', 'City', 'Sales'],    ['Europe', 'France', 'Paris', 120],    ['Asia', 'Japan', 'Tokyo', 180],  ])  .setHierarchyFields([0, 1, 2])  .setValueField(3)  .setSunburstLabel({    visible: true,    position: univerAPI.Enum.ChartSunburstLabelPosition.Outside,    color: '#334155',  })  .setCenterLabel({ visible: true, color: '#0f172a' })  .build()await fDocument.insertChart(chartInfo)

Slide

TypeScript
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const chartInfo = fSlide  .newChart(univerAPI.Enum.ChartTypeString.Sunburst)  .setSource([    ['Region', 'Country', 'City', 'Sales'],    ['Europe', 'France', 'Paris', 120],    ['Asia', 'Japan', 'Tokyo', 180],  ])  .setHierarchyFields([0, 1, 2])  .setValueField(3)  .setSunburstLabel({    visible: true,    position: univerAPI.Enum.ChartSunburstLabelPosition.Outside,    color: '#334155',  })  .setCenterLabel({ visible: true, color: '#0f172a' })  .build()await fSlide.insertChart(chartInfo)

Board

TypeScript
const fBoard = univerAPI.getActiveBoard()const chartInfo = fBoard  .newChart(univerAPI.Enum.ChartTypeString.Sunburst)  .setSource([    ['Region', 'Country', 'City', 'Sales'],    ['Europe', 'France', 'Paris', 120],    ['Asia', 'Japan', 'Tokyo', 180],  ])  .setHierarchyFields([0, 1, 2])  .setValueField(3)  .setSunburstLabel({    visible: true,    position: univerAPI.Enum.ChartSunburstLabelPosition.Outside,    color: '#334155',  })  .setCenterLabel({ visible: true, color: '#0f172a' })  .build()await fBoard.insertChart(chartInfo)

Setup

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

@univerjs-pro/engine-chart

FSunburstChartBuilder.resetCenterLabel

Removes the authored center-label style and restores its hidden default.

TypeScript
resetCenterLabel(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.resetCenterLabel()

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

FSunburstChartBuilder.resetSunburstLabel

Removes explicit label style and restores visible category-name labels.

TypeScript
resetSunburstLabel(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.resetSunburstLabel()

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

FSunburstChartBuilder.setCenterLabel

Sets visibility, number format, and font appearance for the aggregate center value.

TypeScript
setCenterLabel(centerLabel: DeepNullish<IChartSunburstCenterLabelSpec>): this

Parameters

  • centerLabel — Required. Center-label settings.

Returns

This builder for chaining.

Examples

TypeScript
builder.setCenterLabel({ visible: true, color: '#0f172a' })

Types: DeepNullish · IChartSunburstCenterLabelSpec

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

FSunburstChartBuilder.setHierarchyFields

Replaces the ordered inner-to-outer hierarchy with zero-based field indexes.

TypeScript
setHierarchyFields(indexes: readonly number[]): this

Parameters

  • indexes — Required. Ordered hierarchy field indexes.

Returns

This builder for chaining.

Examples

TypeScript
builder.setHierarchyFields([0, 1, 2])

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

FSunburstChartBuilder.setSunburstLabel

Sets label visibility, content, position, and font appearance.

TypeScript
setSunburstLabel(label: DeepNullish<IChartSunburstLabelSpec>): this

Parameters

  • label — Required. Sunburst label settings.

Returns

This builder for chaining.

Examples

TypeScript
builder.setSunburstLabel({  visible: true,  position: univerAPI.Enum.ChartSunburstLabelPosition.Outside,  color: '#334155',})

Types: DeepNullish · IChartSunburstLabelSpec

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

FSunburstChartBuilder.setValueField

Replaces the sole numeric value field with a zero-based field index.

TypeScript
setValueField(index: number): this

Parameters

  • index — Required. Numeric value field index.

Returns

This builder for chaining.

Examples

TypeScript
builder.setValueField(3)

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

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.