更改刻度标签方向

更改刻度标签方向

Aspose.Cells提供了通过 TickLabels.DirectionType 属性改变图表刻度标签方向的能力。 TickLabels.DirectionType 属性接受 ChartTextDirectionType 枚举值。 ChartTextDirectionType 枚举提供以下成员

  • 水平
  • 垂直
  • 旋转90度
  • 旋转270度
  • 堆叠

以下图像比较了源文件和输出文件

源文件图像

todo:image_alt_text

输出文件图像

todo:image_alt_text

以下代码片段将刻度标签方向从Rotate90更改为水平方向

示例代码

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
Workbook workbook = new Workbook(sourceDir + "SampleChangeTickLabelDirection.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
// Load the chart from source worksheet
Chart chart = worksheet.Charts[0];
chart.CategoryAxis.TickLabels.DirectionType = ChartTextDirectionType.Horizontal;
// Output the file
workbook.Save(outputDir + "outputChangeChartDataLableDirection.xlsx");

可以从以下链接下载源文件和输出文件。

源文件

输出文件