FCartesianChartBuilder
Fluent Builder for Cartesian Charts with per-series styling and trendlines.
Inheritance
Extends FAxisChartBuilder. Its inherited members are available on this object.
Example
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.
clearAllSeriesOverrides(): thisPackage: @univerjs-pro/engine-chart · Type definitions
FCartesianChartBuilder.clearAllSeriesStyle
Clears persistent defaults inherited by every series.
This method executes synchronously.
clearAllSeriesStyle(target?: ChartAllSeriesStyleTarget): thisParameters
target— Optional. The global series style field to clear, or omit it to clear all defaults.
Returns
This builder for chaining.
Examples
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.
clearAxisPointer(target?: ChartAxisPointerTarget): thisParameters
target— Optional. The configuration field to clear or reset.
Returns
This builder for chaining.
Examples
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.
clearBar(): thisReturns
This Builder for chaining.
Examples
builder.clearBar()
Package: @univerjs-pro/engine-chart · Type definitions
FCartesianChartBuilder.clearSeries
Clears the series configuration and returns this builder for chaining.
This method executes synchronously.
clearSeries(selector: ChartPublicSeriesSelector, target?: ChartSeriesClearTarget): thisParameters
selector— Required. The target series selector.target— Optional. The configuration field to clear or reset.
Returns
This builder for chaining.
Examples
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.
clearTrendlines(selector?: ChartSeriesTrendlineSelector): thisParameters
selector— Optional. The target series selector.
Returns
This builder for chaining.
Examples
builder.clearTrendlines(0)Types: ChartSeriesTrendlineSelector
Package: @univerjs-pro/engine-chart · Type definitions
FCartesianChartBuilder.removeTrendline
Remove trendline.
This method executes synchronously.
removeTrendline(selector: ChartSeriesTrendlineSelector, trendline: ChartTrendlineSelector): thisParameters
selector— Required. The target series selector.trendline— Required. The trendline configuration to append.
Returns
This builder for chaining.
Examples
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.
setAllSeriesStyle(style: DeepNullish<TSeriesStyle>): thisParameters
style— Required. The global series style defaults.
Returns
This builder for chaining.
Examples
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.
setAxisPointer(value: IChartAxisPointerSpec): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
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.
setBar(value: IChartBarSpec): thisParameters
value— Required. The Bar or Column layout specification.
Returns
This Builder for chaining.
Types: IChartBarSpec
Package: @univerjs-pro/engine-chart · Type definitions
FCartesianChartBuilder.setSeries
Sets the series configuration and returns this builder for chaining.
This method executes synchronously.
setSeries(selector: ChartPublicSeriesSelector, patch: DeepNullish<TSeriesPatch>): thisParameters
selector— Required. The target series selector.patch— Required. The semantic configuration patch owned by this method.
Returns
This builder for chaining.
Examples
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.
setTrendline(selector: ChartSeriesTrendlineSelector, value: ChartTrendlineValue): thisParameters
selector— Required. The target series selector.value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
builder.setTrendline(0, { type: univerAPI.Enum.ChartTrendlineType.linear })Types: ChartSeriesTrendlineSelector · ChartTrendlineValue
Package: @univerjs-pro/engine-chart · Type definitions
How is this guide?