# FSunburstChartBuilder

- Human documentation: [https://docs.univer.ai/reference/facade/sunburst-chart-builder](https://docs.univer.ai/reference/facade/sunburst-chart-builder)

- Agent Markdown: [https://docs.univer.ai/reference/facade/sunburst-chart-builder.md](https://docs.univer.ai/reference/facade/sunburst-chart-builder.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [facade/sunburst-chart-builder.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/facade/sunburst-chart-builder.mdx)

---

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`](https://docs.univer.ai/reference/facade/chart-builder-base.md). Its inherited members are available on this object.

## Example

Sheet

```ts
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

```ts
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

```ts
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

```ts
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`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) 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](https://docs.univer.ai/guides/sheets/getting-started/facade.md).

## `@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**

```ts
builder.resetCenterLabel()
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) · [Type definitions](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/facade/builders/f-sunburst-chart-builder.d.ts)

### `FSunburstChartBuilder.resetSunburstLabel`

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

```typescript
resetSunburstLabel(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.resetSunburstLabel()
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) · [Type definitions](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/facade/builders/f-sunburst-chart-builder.d.ts)

### `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**

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

**Types:** [`DeepNullish`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/types.d.ts) · [`IChartSunburstCenterLabelSpec`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/types.d.ts)

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) · [Type definitions](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/facade/builders/f-sunburst-chart-builder.d.ts)

### `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**

```ts
builder.setHierarchyFields([0, 1, 2])
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) · [Type definitions](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/facade/builders/f-sunburst-chart-builder.d.ts)

### `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**

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

**Types:** [`DeepNullish`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/types.d.ts) · [`IChartSunburstLabelSpec`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/types.d.ts)

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) · [Type definitions](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/facade/builders/f-sunburst-chart-builder.d.ts)

### `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**

```ts
builder.setValueField(3)
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) · [Type definitions](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/facade/builders/f-sunburst-chart-builder.d.ts)
