API 参考

FAxisChartBuilder

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

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

Inheritance

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

Example

TypeScript
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 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

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

TypeScript
builder.clearMarkLines()const markLines = builder.build().config.markLines

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

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

TypeScript
builder.clearRightYAxis(univerAPI.Enum.ChartAxisTarget.Line)

Types: ChartAxisTarget

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

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

TypeScript
builder.clearRightYAxisTitle()

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

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

TypeScript
builder.clearXAxis(univerAPI.Enum.ChartAxisTarget.Label)

Types: ChartAxisTarget

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

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

TypeScript
builder.clearXAxisTitle()

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

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

TypeScript
builder.clearYAxis(univerAPI.Enum.ChartAxisTarget.GridLine)

Types: ChartAxisTarget

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

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

TypeScript
builder.clearYAxisTitle()

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

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

TypeScript
builder.resetUseDateAxis()

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

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

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

Types: IChartMarkLineSpec

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

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

TypeScript
builder.setRightYAxis({ title: 'Margin' })

Types: IChartAxisSpec

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

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

TypeScript
builder.setRightYAxisTitle('Margin')

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

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

TypeScript
builder.setUseDateAxis(true)

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

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

TypeScript
builder.setXAxis({ title: 'Month' })

Types: IChartAxisSpec

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

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

TypeScript
builder.setXAxisTitle('Month')

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

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

TypeScript
builder.setYAxis({ title: 'Revenue' })

Types: IChartAxisSpec

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

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

TypeScript
builder.setYAxisTitle('Revenue')

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

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.