类: PieChartBuilder
The builder for creating a pie chart.
继承
FChartBuilderBase
属性
属性 | 类型 |
---|---|
| |
| |
| |
| |
| |
|
方法
build()
build(): IChartBuilderInfo
Builds the chart to reflect all changes made to it.
返回
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.
参数
参数 | 类型 | 描述 |
---|---|---|
borderColor | string | The 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.
参数
参数 | 类型 | 描述 |
---|---|---|
doughnutHole | number | The 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.
参数
参数 | 类型 | 描述 |
---|---|---|
hasPaddingAngle | boolean | True 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.
参数
参数 | 类型 | 描述 |
---|---|---|
isHalfPie | boolean | True 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.
参数
参数 | 类型 | 描述 |
---|---|---|
rosePie | boolean | True 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.
参数
参数 | 类型 | 描述 |
---|---|---|
showLabelLine | boolean | True if the pie chart shows label lines; false otherwise. |
返回
this
this builder, for chaining.