@univerjs-pro/sheets-chart-ui v0.5.4


Class: RadarChartBuilder

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/radar-chart-builder.ts:8

FBase is a base class for all facade classes. It provides a way to extend classes with static and instance methods. The _initialize as a special method that will be called after the constructor. You should never call it directly.

Extends

Constructors

new RadarChartBuilder()

new RadarChartBuilder(
   unitId, 
   subUnitId, 
   workbook, 
   injector, 
   chartId?): RadarChartBuilder

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/radar-chart-builder.ts:11

Parameters

ParameterType
unitIdstring
subUnitIdstring
workbookWorkbook
injectorInjector
chartId?string

Returns

RadarChartBuilder

Overrides

FChartBuilderBase.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseFChartBuilderBase._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:96
_injectorreadonlyInjectorundefinedFChartBuilderBase._injectorpackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:179
_workbookreadonlyWorkbookundefinedFChartBuilderBase._workbookpackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:178
chartIdpublicstringundefinedFChartBuilderBase.chartIdpackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:183
chartTypepublicChartTypeBitsundefinedFChartBuilderBase.chartTypepackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:192
fillpublicbooleanundefined-packages/sheets-chart-ui/src/facade/chart-builder/radar-chart-builder.ts:10
heightpublicnumberundefinedFChartBuilderBase.heightpackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:191
optionspublicIChartBuildOptionsundefinedFChartBuilderBase.optionspackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:193
rangepublicundefined | IRangeundefinedFChartBuilderBase.rangepackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:185
shapepublicRadarShapeundefined-packages/sheets-chart-ui/src/facade/chart-builder/radar-chart-builder.ts:9
sourceSheetNamepublicundefined | stringundefinedFChartBuilderBase.sourceSheetNamepackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:186
subUnitIdpublicstringundefinedFChartBuilderBase.subUnitIdpackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:182
transposeRowsAndColumnspublicbooleanundefinedFChartBuilderBase.transposeRowsAndColumnspackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:194
unitIdpublicstringundefinedFChartBuilderBase.unitIdpackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:181
widthpublicnumberundefinedFChartBuilderBase.widthpackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:190
xpublicnumberundefinedFChartBuilderBase.xpackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:188
ypublicnumberundefinedFChartBuilderBase.ypackages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:189

Methods

addRange()

addRange(range): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:246

Adds a range to the chart this builder modifies

Parameters

ParameterTypeDescription
rangestring | IRangeThe range string or object to add for chart source data.The should be not a single cell.

Returns

this

-this builder, for chaining

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder
// set the source data range of the chart
.addRange('A1:D6')
.setChartType(ChartTypeBits.Column)
.setPosition(1, 1, 0, 0)
.build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.addRange


asLineChart()

asLineChart(): LineChartBuilder

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/types.ts:14

Returns

LineChartBuilder

Inherited from

FChartBuilderBase.asLineChart


asPieChart()

asPieChart(): PieChartBuilder

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/types.ts:6

Returns

PieChartBuilder

Inherited from

FChartBuilderBase.asPieChart


asRadarChart()

asRadarChart(): RadarChartBuilder

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/types.ts:10

Returns

RadarChartBuilder

Inherited from

FChartBuilderBase.asRadarChart


build()

build(): IChartBuilderInfo

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/radar-chart-builder.ts:75

Builds the chart to reflect all changes made to it.

Returns

IChartBuilderInfo

The chart builder info.

Description

This method does not automatically draw the chart on top of the spreadsheet. A new chart must be inserted via sheet.insertChart(chart), and an existing chart should be updated via sheet.updateChart(chart).

Example

// import { ChartTypeBits } from '@univerjs-pro/sheets-chart';
const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart().asRadarChart();
const chartInfo = chartBuilder.addRange('A1:B8')
.setChartType(ChartTypeBits.Radar)
.setShape(RadarShape.Polygon)
.setFill(true)
.build();
fSheet.insertChart(chartInfo);

Overrides

FChartBuilderBase.build


clearRange()

clearRange(): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:263

Clears the range from the chart this builder modifies

Returns

this

-this builder, for chaining

Inherited from

FChartBuilderBase.clearRange


dispose()

dispose(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:109

Returns

void

Inherited from

FChartBuilderBase.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FChartBuilderBase.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FChartBuilderBase.ensureNotDisposed


getChartType()

getChartType(): ChartTypeBits

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:224

Gets the chart type of the chart this builder modifies.

Returns

ChartTypeBits

ChartType - The chart type of the chart this builder modifies.

Description

The chart type of the chart this builder modifies. The chart type (ChartTypeBits) can be found from package @univerjs-pro/sheets-chart. Please pay attention to the type of the chart you are creating, a Pie chart have a property of Doughnut is donut chart, and a Pie chart have a property of Rose is rose pie chart.But the chart builder will not change the chart type to the corresponding chart type.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const charts = fSheet.getCharts();
if(charts.length > 0) {
 const chart = charts[0];
 const chartBuilder = chart.getChartBuilder();
 const chartType = chartBuilder.getChartType();
 console.log(chartType); // The chart type of first chart.
}
 
#### Inherited from
 
[`FChartBuilderBase`](FChartBuilderBase.md).[`getChartType`](FChartBuilderBase.md#getcharttype)
 
***
 
### setAbsolutePosition()
 
```ts
setAbsolutePosition(x, y): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:331

Sets the position, changing where the chart appears on the sheet by pixel.

Parameters

ParameterTypeDescription
xnumberThe x-coordinate of the chart’s top left-hand corner.
ynumberThe y-coordinate of the chart’s top left-hand corner.

Returns

this

-this builder, for chaining.

Description

The chart’s start anchor position is the top left-hand corner of the chart. This api is opposite to setPosition.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
.setChartType(ChartTypeBits.Column)
// set the chart's top left-hand corner is at (100, 200) pixels.
.setAbsolutePosition(100, 200)
.build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setAbsolutePosition


setAllSeriesStyle()

setAllSeriesStyle(allSeriesStyle): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:727

Sets styles for all series.

Parameters

ParameterTypeDescription
allSeriesStylePartial<IAllSeriesStyle>The style for all series.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
   .setChartType(ChartTypeBits.Line)
   .setPosition(1, 1, 0, 0)
   .setALLSeriesStyle({
     chartType: ChartTypeBits.Line,
     rightYAxis: false,
     color: '#ff0000',
     fillOpacity: 0.5,
     border: {
         color: '#00ff00',
         opacity: 0.5,
         width: 1,
         dashType: ChartBorderDashType.Solid,
      })
   .build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setAllSeriesStyle


setAxisPointerStyle()

setAxisPointerStyle(style): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:682

Sets the axis pointer style

Parameters

ParameterTypeDescription
style| undefined | { indicatorLabelColor: string; indicatorLabelTextColor: string; indicatorLineColor: ChartBorderDashType; indicatorLineType: string; }The style for the axis pointer.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
 .setChartType(ChartTypeBits.Line)
 .setPosition(1, 1, 0, 0)
 .setAxisPointerStyle({
     indicatorLabelColor: '#ff0000',
     indicatorLineType: ChartBorderDashType.Solid,
     indicatorLineColor: '#00ff00',
     indicatorLabelTextColor: '#0000ff',
 })
 .build();
fSheet.insertChart(chartInfo);
 
// a AxisPointerStyle can be defined like following:
 const chartInfo = chartBuilder.setOptions('axisPointer.indicatorLineColor', '#ff0000')
.setOptions('axisPointer.indicatorLineType', ChartBorderDashType.Solid)
.setOptions('axisPointer.indicatorLineColor', '#00ff00')
.setOptions('axisPointer.indicatorLabelTextColor', '#0000ff')
.build();

Inherited from

FChartBuilderBase.setAxisPointerStyle


setChartType()

setChartType(chartType): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:358

The type of chart to create.

Parameters

ParameterTypeDescription
chartTypeChartTypeBitsThe type of chart to create.Which can be found from package @univerjs-pro/sheets-chart.

Returns

this

-this builder, for chaining.

Description

The type of chart to create. The following are the possible values: Line,Column,ColumnStacked,ColumnPercentStacked,Bar,BarStacked,BarPercentStacked,Pie,Doughnut,Area,AreaStacked,AreaPercentStacked,Radar,Scatter,Combination

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
  .setChartType(ChartTypeBits.Column)
  .setPosition(1, 1, 0, 0)
  .build();
fSheet.insertChart(chartInfo);
// update chart type to line
const updateBuilder = fSheet.newChart();
const updateChartInfo = updateBuilder.setChartType(ChartTypeBits.Line).build();
fSheet.updateChart(updateChartInfo);

Inherited from

FChartBuilderBase.setChartType


setFill()

setFill(fill): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/radar-chart-builder.ts:52

Sets whether the radar chart is filled.

Parameters

ParameterTypeDescription
fillbooleanTrue if the radar chart is filled; false otherwise.

Returns

this

this builder, for chaining.

Example

// import { ChartTypeBits } from '@univerjs-pro/sheets-chart';
const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart().asRadarChart();
const chartInfo = chartBuilder.addRange('A1:B8')
.setFill(true)
.build();
fSheet.insertChart(chartInfo);

setHeight()

setHeight(height): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:378

Sets the height of the chart in pixels.

Parameters

ParameterTypeDescription
heightnumberThe height of the chart in pixels.

Returns

this

-this builder, for chaining.

Inherited from

FChartBuilderBase.setHeight


setInvalidValueStrategy()

setInvalidValueStrategy(invalidValueType): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:643

Sets how to handle invalid data in the chart.The possible values are ‘zero’, ‘break’ & ‘link’.

Parameters

ParameterTypeDescription
invalidValueTypeInvalidValueTypeThe type of invalid value to use.

Returns

this

-this builder, for chaining.

Description

The default value is ‘zero’. It means that invalid data will be treated as zero. ‘break’ means that the chart will have a gap where the invalid data is. ‘link’ means that the chart will connect the data points on either side of the invalid data.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
.setChartType(ChartTypeBits.Line)
.setPosition(1, 1, 0, 0)
.setInvalidValueAs(InvalidValueType.Zero)
.build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setInvalidValueStrategy


setOptions()

setOptions(optionPath, optionVal): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:425

The options for the chart. This function will overwrite existing options and merge new options property.

Parameters

ParameterTypeDescription
optionPathstringThe path of the option to set. A ” path means the root of the options object.
optionValunknownThe value to set. Undefined value will be ignore , and null means delete the property.If a path is ”, the value must be the whole options object.

Returns

this

The builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fWorkSheet = fWorkbook.getActiveSheet();
const chartBuilder = fWorkSheet.newChart().asPieChart();
 
const chartBuilderInfo1 = chartBuilder
    .addRange('A1:D6')
    .setOptions('title.content', 'Chart Title')
    .setOptions('legend.position', 'right')
     .setDoughnutHole(0.5)
     .setHasPaddingAngle(true)
     .setRosePie(true)
     .setIsHalfPie(true)
    .build();
// setOptions can be replaced by setOptions('', { ... })
const chartBuilderInfo2 = chartBuilder
    .addRange('A1:D6')
    .setOptions('', {
    "title": {
        "content": "Chart Title"
    },
    "legend": {
        "position": "right"
    },
    "pie": {
        "doughnutHole": 0.5,
        "hasPaddingAngle": true,
        "isHalfPie": true,
        "rosePie": true
    }
}).build();
fWorkSheet.insertChart(chartBuilderInfo1);
// or they are same effect
// fWorkSheet.insertChart(chartBuilderInfo2);

Inherited from

FChartBuilderBase.setOptions


setPosition()

setPosition(
   anchorRowPos, 
   anchorColPos, 
   rowOffset, 
   columnOffset): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:290

Sets the position, changing where the chart appears on the sheet. anchorRowPos and anchorColPos are 0-indexed.This api can only work in the active sheet.

Parameters

ParameterTypeDescription
anchorRowPosnumberThe chart’s top side is anchored in this row.
anchorColPosnumberThe chart’s left side is anchored in this column.
rowOffsetnumberThe chart’s top left-hand corner is offset by this many pixels.
columnOffsetnumberThe chart’s lower left-hand corner is offset by this many pixels.

Returns

this

-this builder, for chaining

Description

The chart’s start anchor position is the top left-hand corner of the chart. The rowOffset and columnOffset are the pixel offsets from the anchor position.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
 .setChartType(ChartTypeBits.Column)
 // set the chart's top side is anchored in row 2, left side is anchored in column 5, and the chart's top left-hand corner is offset by 20 pixels.
 .setPosition(2, 5, 20, 20)
 .build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setPosition


setRightYAxisTextStyle()

setRightYAxisTextStyle(textStyle): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:619

Sets the text style for the chart right y-axis. Only works in charts have right y-axis.

Parameters

ParameterTypeDescription
textStyleIChartTextStyleThe text style for the chart right y-axis.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
.setChartType(ChartTypeBits.Line)
.setPosition(1, 1, 0, 0)
.setRightYAxisTextStyle({ content: 'rightYAxis Title text', fontSize: 12, fontColor: '#ff0000' })
.build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setRightYAxisTextStyle


setRightYAxisTitle()

setRightYAxisTitle(title): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:549

Sets the title of the chart right y-axis.

Parameters

ParameterTypeDescription
titlestringThe title of the chart right y-axis.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
.setChartType(ChartTypeBits.Line)
.setPosition(1, 1, 0, 0)
.setRightYAxisTitle('rightYAxis Title text')
.build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setRightYAxisTitle


setSeriesStyle()

setSeriesStyle(index, seriesStyle): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:760

Sets the series style by series index.

Parameters

ParameterTypeDescription
indexstring | numberThe index of the series to set the style for.
seriesStyleISeriesStyleThe style for the series.

Returns

this

-this builder, for chaining.

Description

Like setALLSeriesStyle, this difference is the style only set for the provide sty

Example

 const fWorkbook = univerAPI.getActiveWorkbook();
 const fSheet = fWorkbook.getActiveSheet();
 const chartBuilder = fSheet.newChart();
 const chartInfo = chartBuilder.addRange('A1:D6').setChartType(2).setPosition(1, 1, 0, 0).build();
 const fChart = await fSheet.insertChart(chartInfo);
 // should wait the chart rendered
 setTimeout( () => {
     if (fChart) {
         const chartBuilder = fSheet.newChart(fChart);
         // get the series data
         const first = fChart.getSeriesData()[0];
         chartBuilder.setSeriesStyle(first.index, {
             color: '#ff0000',
         }).build();
         fSheet.updateChart(chartBuilder);
     }
 }
 , 1000);

Inherited from

FChartBuilderBase.setSeriesStyle


setShape()

setShape(shape): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/radar-chart-builder.ts:31

Sets the shape of the radar chart.

Parameters

ParameterTypeDescription
shapeRadarShapeThe shape of the radar chart.

Returns

this

this builder, for chaining.

Example

// import { ChartTypeBits, RadarShape } from '@univerjs-pro/sheets-chart';
const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart().asRadarChart();
const chartInfo = chartBuilder.addRange('A1:B8')
.setShape(RadarShape.Polygon)
.build();
fSheet.insertChart(chartInfo);

setTheme()

setTheme(theme): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:479

Sets the theme of the chart. If the theme name not registered, a default theme will be used.

Parameters

ParameterTypeDescription
themestringThe theme name of the chart.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
 .setChartType(ChartTypeBits.Column)
 .setPosition(1, 1, 0, 0)
 .setTheme('univer1')
 .build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setTheme


setTransposeRowsAndColumns()

setTransposeRowsAndColumns(transposeRowsAndColumns): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:457

Sets whether to transpose the rows and columns of the chart.

Parameters

ParameterTypeDescription
transposeRowsAndColumnsbooleanWhether to transpose the rows and columns of the chart.The default value is false.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
.setChartType(ChartTypeBits.Column)
.setPosition(1, 1, 0, 0)
// the chart will transpose the rows and columns
.setTransposeRowsAndColumns(true)
.build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setTransposeRowsAndColumns


setWidth()

setWidth(width): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:368

Sets the width of the chart in pixels.

Parameters

ParameterTypeDescription
widthnumberThe width of the chart in pixels.

Returns

this

-this builder, for chaining.

Inherited from

FChartBuilderBase.setWidth


setXAxisTextStyle()

setXAxisTextStyle(textStyle): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:573

Sets the text style for the chart x-axis.

Parameters

ParameterTypeDescription
textStyleIChartTextStyleThe text style for the chart x-axis.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
 .setChartType(ChartTypeBits.Column)
.setPosition(1, 1, 0, 0)
.setXAxisTextStyle({ content: 'xAxis Title text', fontSize: 12, fontColor: '#ff0000' })
.build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setXAxisTextStyle


setXAxisTitle()

setXAxisTitle(title): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:501

Sets the title of the chart x-axis.

Parameters

ParameterTypeDescription
titlestringThe title of the chart x-axis.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
  .setChartType(ChartTypeBits.Column)
  .setPosition(1, 1, 0, 0)
  .setXAxisTitle('xAxis Title text')
  .build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setXAxisTitle


setYAxisTextStyle()

setYAxisTextStyle(textStyle): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:596

Sets the text style for the chart y-axis.

Parameters

ParameterTypeDescription
textStyleIChartTextStyleThe text style for the chart y-axis.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
.setChartType(ChartTypeBits.Line)
.setPosition(1, 1, 0, 0)
.setYAxisTextStyle({ content: 'yAxis Title text', fontSize: 12, fontColor: '#ff0000' })
.build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setYAxisTextStyle


setYAxisTitle()

setYAxisTitle(title): this

Defined in: packages/sheets-chart-ui/src/facade/chart-builder/chart-builder-base.ts:525

Sets the title of the chart y-axis.

Parameters

ParameterTypeDescription
titlestringThe title of the chart y-axis.

Returns

this

-this builder, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fSheet = fWorkbook.getActiveSheet();
const chartBuilder = fSheet.newChart();
const chartInfo = chartBuilder.addRange('A1:D6')
 .setChartType(ChartTypeBits.Line)
 .setPosition(1, 1, 0, 0)
 .setYAxisTitle('yAxis Title text')
 .build();
fSheet.insertChart(chartInfo);

Inherited from

FChartBuilderBase.setYAxisTitle


extend()

static extend(source): void

Defined in: submodules/univer/packages/core/src/facade/f-base.ts:26

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FChartBuilderBase.extend