API Reference

FCartesianChartBuilder

Fluent Builder for Cartesian Charts with per-series styling and trendlines.

Inheritance

Extends FAxisChartBuilder. 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.Column)  .setSource('A1:D8')  .setBar({ gapWidth: 0.2 })  .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

FCartesianChartBuilder.clearAllSeriesOverrides

Clears every per-series override while preserving all-series defaults. Use setSeries() to write one selector and describe().series to read the effective state.

TypeScript
clearAllSeriesOverrides(): this

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

FCartesianChartBuilder.clearAllSeriesStyle

Clears persistent defaults inherited by every series.

This method executes synchronously.

TypeScript
clearAllSeriesStyle(target?: ChartAllSeriesStyleTarget): this

Parameters

  • target — Optional. The global series style field to clear, or omit it to clear all defaults.

Returns

This builder for chaining.

Examples

TypeScript
builder.clearAllSeriesStyle(univerAPI.Enum.ChartAllSeriesStyleTarget.Color)

Types: ChartAllSeriesStyleTarget

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

FCartesianChartBuilder.clearAxisPointer

Clears the axis pointer configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
clearAxisPointer(target?: ChartAxisPointerTarget): this

Parameters

  • target — Optional. The configuration field to clear or reset.

Returns

This builder for chaining.

Examples

TypeScript
builder.clearAxisPointer(univerAPI.Enum.ChartAxisPointerTarget.IndicatorLineColor)

Types: ChartAxisPointerTarget

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

FCartesianChartBuilder.clearBar

Clears Chart-wide Bar and Column layout overrides.

TypeScript
clearBar(): this

Returns

This Builder for chaining.

Examples

builder.clearBar()

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

FCartesianChartBuilder.clearErrorBars

Clears the error bars without changing trendlines or other configuration.

TypeScript
clearErrorBars(): this

Returns

This builder for chaining.

Examples

builder.clearErrorBars()

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

FCartesianChartBuilder.clearSeries

Clears the series configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
clearSeries(selector: ChartPublicSeriesSelector, target?: ChartSeriesClearTarget): this

Parameters

  • selector — Required. The target series selector.
  • target — Optional. The configuration field to clear or reset.

Returns

This builder for chaining.

Examples

TypeScript
builder.clearSeries(0)

Types: ChartPublicSeriesSelector · ChartSeriesClearTarget

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

FCartesianChartBuilder.clearTrendlines

Clears the trendlines configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
clearTrendlines(selector?: ChartSeriesTrendlineSelector): this

Parameters

  • selector — Optional. The target series selector.

Returns

This builder for chaining.

Examples

TypeScript
builder.clearTrendlines(0)

Types: ChartSeriesTrendlineSelector

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

FCartesianChartBuilder.removeTrendline

Remove trendline.

This method executes synchronously.

TypeScript
removeTrendline(selector: ChartSeriesTrendlineSelector, trendline: ChartTrendlineSelector): this

Parameters

  • selector — Required. The target series selector.
  • trendline — Required. The trendline configuration to append.

Returns

This builder for chaining.

Examples

TypeScript
builder.removeTrendline(0, 0)

Types: ChartSeriesTrendlineSelector · ChartTrendlineSelector

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

FCartesianChartBuilder.setAllSeriesStyle

Sets persistent defaults inherited by every current and future series.

This method executes synchronously.

TypeScript
setAllSeriesStyle(style: DeepNullish<TSeriesStyle>): this

Parameters

  • style — Required. The global series style defaults.

Returns

This builder for chaining.

Examples

TypeScript
builder.setAllSeriesStyle({ color: '#1677ff', fillOpacity: 0.8 })

Types: DeepNullish

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

FCartesianChartBuilder.setAxisPointer

Sets the axis pointer configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
setAxisPointer(value: IChartAxisPointerSpec): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
builder.setAxisPointer({ indicatorLineColor: '#1677ff' })

Types: IChartAxisPointerSpec

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

FCartesianChartBuilder.setBar

Sets Chart-wide Bar and Column spacing and width options.

TypeScript
setBar(value: IChartBarSpec): this

Parameters

  • value — Required. The Bar or Column layout specification.

Returns

This Builder for chaining.

Types: IChartBarSpec

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

FCartesianChartBuilder.setErrorBars

Replaces the entire collection; entries omitted from this call are removed. seriesIndex is a zero-based source-field index, including category fields: for source columns [Category, Sales], Sales is 1, even if it is the first visible series. direction targets a numeric axis: y for Column/Line, x for Bar, x or y for Scatter. type selects both / plus / minus. Each (seriesIndex, direction) can occur only once. valueType and value: fixedVal uses axis units; percentage uses 20 for 20%; stdDev uses 2 for two series standard deviations and centers bars on the series mean; stdErr computes the standard error and omits value. noEndCap: false shows caps; true hides them. Optional line fields are color, width, opacity (0–1), visible, and dashType (ChartBorderDashType.Solid / Dashed / Dotted). Supports basic 2D Column, Bar, Line and Scatter charts. Custom errors use valueType: 'cust' with plusIndex / minusIndex referencing positive / negative error fields in the same data source; omit value and supply the field for each enabled direction. Literal arrays are unsupported.

TypeScript
setErrorBars(errorBars: readonly IChartErrorBars[]): this

Parameters

  • errorBars — Required. The complete error-bar collection, copied into the detached draft.

Returns

This builder for chaining. Call build() and insert/update the chart to persist it.

Examples

TypeScript
import { ChartBorderDashType } from '@univerjs-pro/engine-chart'// Source columns: 0 = Category, 1 = Sales.const info = worksheet  .newChart(univerAPI.Enum.ChartTypeString.Column)  .setSource('A1:B4')  .setErrorBars([    {      seriesIndex: 1,      direction: 'y',      type: 'both',      valueType: 'percentage',      value: 20,      noEndCap: false,      line: { color: '#C00000', width: 2, dashType: ChartBorderDashType.Solid },    },  ])  .build()const chart = await worksheet.insertChart(info)console.log(chart.getInfo().config.errorBars)

Types: IChartErrorBars

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

FCartesianChartBuilder.setSeries

Sets the series configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
setSeries(selector: ChartPublicSeriesSelector, patch: DeepNullish<TSeriesPatch>): this

Parameters

  • selector — Required. The target series selector.
  • patch — Required. The semantic configuration patch owned by this method.

Returns

This builder for chaining.

Examples

TypeScript
import { chartLinearGradient } from '@univerjs-pro/engine-chart'const color = chartLinearGradient({  start: { x: 0, y: 1 },  end: { x: 0, y: 0 },  stops: [    { offset: 0, color: 'rgba(22, 119, 255, 0)' },    { offset: 1, color: '#1677ff' },  ],})builder.setSeries(0, { color })

Types: ChartPublicSeriesSelector · DeepNullish

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

FCartesianChartBuilder.setTrendline

Sets the trendline configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
setTrendline(selector: ChartSeriesTrendlineSelector, value: ChartTrendlineValue): this

Parameters

  • selector — Required. The target series selector.
  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
builder.setTrendline(0, { type: univerAPI.Enum.ChartTrendlineType.linear })

Types: ChartSeriesTrendlineSelector · ChartTrendlineValue

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

How is this guide?

© 2026 DreamNum Co., Ltd.