Change Tick Label Direction
Change Tick Label Direction
Aspose.Cells provides you with the ability to change the chart tick label direction by using the TickLabels.DirectionType property. The TickLabels.DirectionType property accepts the ChartTextDirectionType enumeration value. The ChartTextDirectionType enumeration provides the following members
The following image compares the source and output files
Source file image
Output file image
The following code snippet changes the tick label direction from ROTATE_90 to HORIZONTAL.
Sample Code
// 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"); |
The source and output files can be downloaded from the following links.