Skip to Content
ClassesPieChartBuilder

类: PieChartBuilder

The builder for creating a pie chart.

继承

  • FChartBuilderBase

属性

属性类型

borderColor

string

doughnutHole

number

hasPaddingAngle

boolean

isHalfPie

boolean

rosePie

boolean

showLabelLine

boolean

方法

build()

build(): IChartBuilderInfo

Builds the chart to reflect all changes made to it.

返回

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).

示例

const fWorkbook = univerAPI.getActiveWorkbook(); const fSheet = fWorkbook.getActiveSheet(); const chartBuilder = fSheet.newChart().asPieChart(); const chartInfo = chartBuilder.addRange('A1:B8') .setChartType(univerAPI.Enum.ChartType.Pie) .setDoughnutHole(0.5) .setBorderColor('#ff0000') .setHasPaddingAngle(true) .setIsHalfPie(true) .build(); fSheet.insertChart(chartInfo);

重写了

FChartBuilderBase.build

setBorderColor()

setBorderColor(borderColor): this

Sets the color of the border around the pie chart.

参数

参数类型描述
borderColorstringThe color of the border around the pie chart.

返回

this

this builder, for chaining.


setDoughnutHole()

setDoughnutHole(doughnutHole): this

Sets the size of the hole in the center of the pie chart as a percentage of the chart size.The value should be in the range 0-1.

参数

参数类型描述
doughnutHolenumberThe size of the hole in the center of the pie chart as a percentage of the chart size.

返回

this

this builder, for chaining.


setHasPaddingAngle()

setHasPaddingAngle(hasPaddingAngle): this

Sets whether the pie chart has a padding angle.

参数

参数类型描述
hasPaddingAnglebooleanTrue if the pie chart has a padding angle; false otherwise.

返回

this

this builder, for chaining.


setIsHalfPie()

setIsHalfPie(isHalfPie): this

Sets whether the pie chart is a half pie chart.

参数

参数类型描述
isHalfPiebooleanTrue if the pie chart is a half pie chart; false otherwise.

返回

this

this builder, for chaining.


setRosePie()

setRosePie(rosePie): this

Sets whether the pie chart is a rose pie chart.

参数

参数类型描述
rosePiebooleanTrue if the pie chart is a rose pie chart; false otherwise.

返回

this

this builder, for chaining.


setShowLabelLine()

setShowLabelLine(showLabelLine): this

Sets whether the pie chart shows label lines.

参数

参数类型描述
showLabelLinebooleanTrue if the pie chart shows label lines; false otherwise.

返回

this

this builder, for chaining.