# FWordCloudChartBuilder

> Language fallback: requested `zh-CN`; content is `en-US`.

- Human documentation: [https://docs.univer.ai/zh-CN/reference/facade/word-cloud-chart-builder](https://docs.univer.ai/zh-CN/reference/facade/word-cloud-chart-builder)

- Agent Markdown: [https://docs.univer.ai/zh-CN/reference/facade/word-cloud-chart-builder.md](https://docs.univer.ai/zh-CN/reference/facade/word-cloud-chart-builder.md)

- Requested language: `zh-CN`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

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

---

Fluent, type-specific Builder for Word Cloud Charts.

## Inheritance

Extends [`FChartBuilderBase`](https://docs.univer.ai/zh-CN/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.WordCloud)
  .setSource('A1:B8')
  .setCategoryField(0)
  .setValueFields([1])
  .setShape(univerAPI.Enum.ChartWordCloudShapeEnum.Circle)
  .setRepeat(true)
  .build()
await fWorksheet.insertChart(chartInfo)
```

Doc

```ts
const fDocument = univerAPI.getActiveDocument()
const chartInfo = fDocument
  .newChart(univerAPI.Enum.ChartTypeString.WordCloud)
  .setSource([
    ['Word', 'Frequency'],
    ['Univer', 42],
    ['Chart', 28],
    ['Data', 18],
  ])
  .setCategoryField(0)
  .setValueFields([1])
  .setShape(univerAPI.Enum.ChartWordCloudShapeEnum.Circle)
  .setRepeat(true)
  .build()
await fDocument.insertChart(chartInfo)
```

Slide

```ts
const fPresentation = univerAPI.getActivePresentation()
const fSlide = fPresentation.getSlideByIndex(0)
const chartInfo = fSlide
  .newChart(univerAPI.Enum.ChartTypeString.WordCloud)
  .setSource([
    ['Word', 'Frequency'],
    ['Univer', 42],
    ['Chart', 28],
    ['Data', 18],
  ])
  .setCategoryField(0)
  .setValueFields([1])
  .setShape(univerAPI.Enum.ChartWordCloudShapeEnum.Circle)
  .setRepeat(true)
  .build()
await fSlide.insertChart(chartInfo)
```

Board

```ts
const fBoard = univerAPI.getActiveBoard()
const chartInfo = fBoard
  .newChart(univerAPI.Enum.ChartTypeString.WordCloud)
  .setSource([
    ['Word', 'Frequency'],
    ['Univer', 42],
    ['Chart', 28],
    ['Data', 18],
  ])
  .setCategoryField(0)
  .setValueFields([1])
  .setShape(univerAPI.Enum.ChartWordCloudShapeEnum.Circle)
  .setRepeat(true)
  .build()
await fBoard.insertChart(chartInfo)
```

## Setup

Register [`@univerjs-pro/engine-chart`](https://docs.univer.ai/zh-CN/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/zh-CN/guides/sheets/getting-started/facade.md).

## `@univerjs-pro/engine-chart`

### `FWordCloudChartBuilder.clearMaskImage`

Clears the mask image configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
clearMaskImage(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.clearMaskImage()
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/zh-CN/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-word-cloud-chart-builder.d.ts)

### `FWordCloudChartBuilder.resetRepeat`

Restores the default of not repeating words and returns this builder for chaining.

This method executes synchronously.

```typescript
resetRepeat(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.resetRepeat()
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/zh-CN/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-word-cloud-chart-builder.d.ts)

### `FWordCloudChartBuilder.resetShape`

Restores the word-cloud shape to `Cloud` and returns this builder for chaining.

This method executes synchronously.

```typescript
resetShape(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.resetShape()
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/zh-CN/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-word-cloud-chart-builder.d.ts)

### `FWordCloudChartBuilder.setMaskImage`

Sets the mask image configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
setMaskImage(resourceId: string): this
```

**Parameters**

* `resourceId` — Required. The host resource ID.

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setMaskImage('resource-id')
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/zh-CN/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-word-cloud-chart-builder.d.ts)

### `FWordCloudChartBuilder.setRepeat`

Sets the repeat configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
setRepeat(value: boolean): this
```

**Parameters**

* `value` — Required. The semantic value to record.

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setRepeat(true)
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/zh-CN/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-word-cloud-chart-builder.d.ts)

### `FWordCloudChartBuilder.setShape`

Sets the shape configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
setShape(value: WordCloudShapeEnum): this
```

**Parameters**

* `value` — Required. The semantic value to record.

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setShape(univerAPI.Enum.ChartWordCloudShapeEnum.Cloud)
```

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

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/zh-CN/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-word-cloud-chart-builder.d.ts)
