# FAxisChartBuilder

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

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

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

- Requested language: `zh-CN`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

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

---

Fluent base Builder for Charts that expose Cartesian axes and mark lines.

## Inheritance

Extends [`FChartBuilderBase`](https://docs.univer.ai/zh-CN/reference/facade/chart-builder-base.md). Its inherited members are available on this object.

## Example

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getSheetByName('Sheet1')
const chartInfo = fWorksheet
  .newChart(univerAPI.Enum.ChartTypeString.Line)
  .setSource('A1:D8')
  .setYAxisTitle('Revenue')
  .build()
await fWorksheet.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`

### `FAxisChartBuilder.clearMarkLines`

Clears all fixed-axis mark lines.

Read the cleared value from `builder.build().config.markLines`.

```typescript
clearMarkLines(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.clearMarkLines()
const markLines = builder.build().config.markLines
```

**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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.clearRightYAxis`

Clears the right yaxis configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
clearRightYAxis(target?: ChartAxisTarget): this
```

**Parameters**

* `target` — Optional. The configuration field to clear or reset.

**Returns**

This builder for chaining.

**Examples**

```ts
builder.clearRightYAxis(univerAPI.Enum.ChartAxisTarget.Line)
```

**Types:** [`ChartAxisTarget`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/chart-builder/configuration/axes.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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.clearRightYAxisTitle`

Clears the right yaxis title configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
clearRightYAxisTitle(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.clearRightYAxisTitle()
```

**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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.clearXAxis`

Clears the xaxis configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
clearXAxis(target?: ChartAxisTarget): this
```

**Parameters**

* `target` — Optional. The configuration field to clear or reset.

**Returns**

This builder for chaining.

**Examples**

```ts
builder.clearXAxis(univerAPI.Enum.ChartAxisTarget.Label)
```

**Types:** [`ChartAxisTarget`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/chart-builder/configuration/axes.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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.clearXAxisTitle`

Clears the xaxis title configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
clearXAxisTitle(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.clearXAxisTitle()
```

**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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.clearYAxis`

Clears the yaxis configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
clearYAxis(target?: ChartAxisTarget): this
```

**Parameters**

* `target` — Optional. The configuration field to clear or reset.

**Returns**

This builder for chaining.

**Examples**

```ts
builder.clearYAxis(univerAPI.Enum.ChartAxisTarget.GridLine)
```

**Types:** [`ChartAxisTarget`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/chart-builder/configuration/axes.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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.clearYAxisTitle`

Clears the yaxis title configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
clearYAxisTitle(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.clearYAxisTitle()
```

**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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.resetUseDateAxis`

Restores the default of using a category axis instead of a date axis and returns this builder for chaining.

This method executes synchronously.

```typescript
resetUseDateAxis(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.resetUseDateAxis()
```

**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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.setMarkLines`

Replaces all fixed-axis mark lines.

Omitted line-style fields use a 1 px solid stroke at full opacity and inherit the carrier
series color, falling back to the active theme. Endpoint symbols are hidden. Labels are hidden
unless a `label` object is supplied; an empty label object shows the axis-formatted value.

Read the current value from `builder.build().config.markLines`.

```typescript
setMarkLines(lines: readonly IChartMarkLineSpec[]): this
```

**Parameters**

* `lines` — Required. The complete ordered mark-line collection. An empty list clears it.

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setMarkLines([{ axis: univerAPI.Enum.ChartSemanticAxis.PrimaryValue, value: 80 }])
const markLines = builder.build().config.markLines
```

**Types:** [`IChartMarkLineSpec`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/chart-builder/chart-types.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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.setRightYAxis`

Sets the right yaxis configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
setRightYAxis(value: IChartAxisSpec): this
```

**Parameters**

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

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setRightYAxis({ title: 'Margin' })
```

**Types:** [`IChartAxisSpec`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/chart-builder/chart-types.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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.setRightYAxisTitle`

Sets the right yaxis title configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
setRightYAxisTitle(value: string): this
```

**Parameters**

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

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setRightYAxisTitle('Margin')
```

**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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.setUseDateAxis`

Sets the use date axis configuration and returns this builder for chaining.

This method executes synchronously.

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

**Parameters**

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

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setUseDateAxis(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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.setXAxis`

Sets the xaxis configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
setXAxis(value: IChartAxisSpec): this
```

**Parameters**

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

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setXAxis({ title: 'Month' })
```

**Types:** [`IChartAxisSpec`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/chart-builder/chart-types.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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.setXAxisTitle`

Sets the xaxis title configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
setXAxisTitle(value: string): this
```

**Parameters**

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

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setXAxisTitle('Month')
```

**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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.setYAxis`

Sets the yaxis configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
setYAxis(value: IChartAxisSpec): this
```

**Parameters**

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

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setYAxis({ title: 'Revenue' })
```

**Types:** [`IChartAxisSpec`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/chart-builder/chart-types.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/f-axis-chart-builder.d.ts)

### `FAxisChartBuilder.setYAxisTitle`

Sets the yaxis title configuration and returns this builder for chaining.

This method executes synchronously.

```typescript
setYAxisTitle(value: string): this
```

**Parameters**

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

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setYAxisTitle('Revenue')
```

**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/f-axis-chart-builder.d.ts)
