更改刻度标签方向
Contents
[
Hide
]
更改刻度标签方向
Aspose.Cells提供了通过使用TickLabels.DirectionType属性来更改图表刻度标签方向的能力。TickLabels.DirectionType属性接受ChartTextDirectionType枚举值。ChartTextDirectionType枚举提供以下成员
以下图像比较了源文件和输出文件
源文件图像
输出文件图像
以下代码片段将刻度标签方向从ROTATE_90更改为HORIZONTAL
示例代码
This file contains 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 | |
//Source directory | |
String sourceDir = Utils.Get_SourceDirectory(); | |
//Output directory | |
String outputDir = Utils.Get_OutputDirectory(); | |
// Instantiating a Workbook object | |
Workbook workbook = new Workbook(sourceDir + "SampleChangeTickLabelDirection.xlsx"); | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Load the chart from source worksheet | |
Chart chart = worksheet.getCharts().get(0); | |
chart.getCategoryAxis().getTickLabels().setDirectionType(ChartTextDirectionType.HORIZONTAL); | |
// Output the file | |
workbook.save(outputDir + "outputChangeTickLabelDirection.xlsx"); |
可以从以下链接下载源文件和输出文件。