FAxisChartBuilder
Fluent base Builder for Charts that expose Cartesian axes and mark lines.
Inheritance
Extends FChartBuilderBase. 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.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.
clearMarkLines(): thisReturns
This builder for chaining.
Examples
builder.clearMarkLines()const markLines = builder.build().config.markLinesPackage: @univerjs-pro/engine-chart · Type definitions
FAxisChartBuilder.clearRightYAxis
Clears the right yaxis configuration and returns this builder for chaining.
This method executes synchronously.
clearRightYAxis(target?: ChartAxisTarget): thisParameters
target— Optional. The configuration field to clear or reset.
Returns
This builder for chaining.
Examples
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.
clearRightYAxisTitle(): thisReturns
This builder for chaining.
Examples
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.
clearXAxis(target?: ChartAxisTarget): thisParameters
target— Optional. The configuration field to clear or reset.
Returns
This builder for chaining.
Examples
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.
clearXAxisTitle(): thisReturns
This builder for chaining.
Examples
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.
clearYAxis(target?: ChartAxisTarget): thisParameters
target— Optional. The configuration field to clear or reset.
Returns
This builder for chaining.
Examples
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.
clearYAxisTitle(): thisReturns
This builder for chaining.
Examples
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.
resetUseDateAxis(): thisReturns
This builder for chaining.
Examples
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.
setMarkLines(lines: readonly IChartMarkLineSpec[]): thisParameters
lines— Required. The complete ordered mark-line collection. An empty list clears it.
Returns
This builder for chaining.
Examples
builder.setMarkLines([{ axis: univerAPI.Enum.ChartSemanticAxis.PrimaryValue, value: 80 }])const markLines = builder.build().config.markLinesTypes: 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.
setRightYAxis(value: IChartAxisSpec): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
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.
setRightYAxisTitle(value: string): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
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.
setUseDateAxis(value: boolean): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
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.
setXAxis(value: IChartAxisSpec): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
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.
setXAxisTitle(value: string): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
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.
setYAxis(value: IChartAxisSpec): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
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.
setYAxisTitle(value: string): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
builder.setYAxisTitle('Revenue')Package: @univerjs-pro/engine-chart · Type definitions
How is this guide?