Change Tick Label Direction

Change Tick Label Direction

Aspose.Cells for Python via .NET provides you with the ability to change the chart tick label direction by using the TickLabels.direction_type property. The TickLabels.direction_type property accepts the ChartTextDirectionType enumeration value. The ChartTextDirectionType enumeration provides the following members

  • HORIZONTAL
  • VERTICAL
  • ROTATE90
  • ROTATE270
  • STACKED

The following image compares the source and output files

Source file image

todo:image_alt_text

Output file image

todo:image_alt_text

The following code snippet changes the tick label direction from Rotate90 to Horizontal.

Sample Code

from aspose.cells import Workbook
from aspose.cells.charts import ChartTextDirectionType
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
workbook = Workbook(sourceDir + "SampleChangeTickLabelDirection.xlsx")
worksheet = workbook.worksheets[0]
# Load the chart from source worksheet
chart = worksheet.charts[0]
chart.category_axis.tick_labels.direction_type = ChartTextDirectionType.HORIZONTAL
# Output the file
workbook.save(outputDir + "outputChangeChartDataLableDirection.xlsx")

The source and output files can be downloaded from the following links.

Source File

Output File