Référence de l’API

FAxisChartBuilder

Cette page API est actuellement disponible en anglais. Les signatures et identifiants restent identiques dans toutes les langues.

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 Y axis configuration and returns this builder for chaining. Clearing an entire logarithmic axis writes explicit linear intent so imported raw chart data cannot restore the old logarithmic scale. Clearing a field keeps the scale.

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 existing secondary Y axis configuration and returns this builder for chaining. Logarithmic settings follow setYAxis; this does not create a secondary Bar axis.

This method executes synchronously.

TypeScript
setRightYAxis(value: IChartAxisSpec): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
// The existing Line chart already has a series assigned to its secondary axis.const sheet = univerAPI.getActiveWorkbook().getActiveSheet()const chart = sheet.getCharts()[0]const builder = chart  .toBuilder(univerAPI.Enum.ChartTypeString.Line)  .setYAxis({ scaleType: 'linear' })  .setRightYAxis({ scaleType: 'log', logBase: 2 })await chart.update(builder.build())

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 X axis configuration and returns this detached builder for chaining. On a supported Bar chart, { scaleType: 'log', logBase: 2.5 } selects its numeric scale. Unsupported axis configurations are retained and reported by chart diagnostics.

This method executes synchronously.

TypeScript
setXAxis(value: IChartAxisSpec): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
// Bar charts use the X axis as their numeric axis.const sheet = univerAPI.getActiveWorkbook().getActiveSheet()const chartInfo = sheet  .newChart(univerAPI.Enum.ChartTypeString.Bar)  .setSource('A1:B8')  .setXAxis({ scaleType: 'log', logBase: 10 })  .build()await sheet.insertChart(chartInfo)

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 Y axis configuration and returns this detached builder for chaining. Supported numeric axes accept { scaleType: 'log', logBase: 2.5 }. Missing base defaults to 10 when first enabled. Finite out-of-range values are retained for compatibility and render with base 10 plus diagnostics. Normal input uses 2–1000. Apply an existing-chart draft with await chart.update(builder.build()). Explicit scaleType: 'linear' removes the base; unrelated patches preserve it.

This method executes synchronously.

TypeScript
setYAxis(value: IChartAxisSpec): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
// Update an existing Line chart; Area and Column use the same Y-axis settings.const sheet = univerAPI.getActiveWorkbook().getActiveSheet()const chart = sheet.getCharts()[0]const builder = chart  .toBuilder(univerAPI.Enum.ChartTypeString.Line)  .setYAxis({ scaleType: 'log', logBase: 2.5 })await chart.update(builder.build())// Change only the base of the logarithmic axis.await chart.update(  chart.toBuilder(univerAPI.Enum.ChartTypeString.Line).setYAxis({ logBase: 2 }).build(),)// Restore linear scaling and remove the logarithm base.await chart.update(  chart.toBuilder(univerAPI.Enum.ChartTypeString.Line).setYAxis({ scaleType: 'linear' }).build(),)

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

Que pensez-vous de ce guide ?

© 2026 DreamNum Co., Ltd.