设置图表数据标签的形状类型
Contents
[
Hide
]
可能的使用场景
您可以使用更改图表数据标签的形状类型数据标签.ShapeType财产。它取值数据标签形状类型枚举并相应地更改数据标签的形状类型。它的一些值是
DataLabelShapeType.BENT_LINE_CALLOUT
DataLabelShapeType.DOWN_ARROW_CALLOUT
DataLabelShapeType.ELLIPSE
DataLabelShapeType.LINE_CALLOUT
DataLabelShapeType.RECT
etc.
设置图表数据标签的形状类型
以下示例代码将图表数据标签的形状类型更改为DataLabelShapeType.WEDGE_ELLIPSE_CALLOUT.请参阅示例 Excel 文件用于此代码和输出Excel文件由它产生。屏幕截图显示了代码对示例 Excel 文件的影响。
示例代码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Load source Excel file | |
Workbook wb = new Workbook("sampleSetShapeTypeOfDataLabelsOfChart.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access first chart | |
Chart ch = ws.getCharts().get(0); | |
//Access first series | |
Series srs = ch.getNSeries().get(0); | |
//Set the shape type of data labels i.e. Speech Bubble Oval | |
srs.getDataLabels().setShapeType(DataLabelShapeType.WEDGE_ELLIPSE_CALLOUT); | |
//Save the output Excel file | |
wb.save("outputSetShapeTypeOfDataLabelsOfChart.xlsx"); |