目盛りラベル方向の変更

目盛りラベル方向の変更

Aspose.Cellsは、TickLabels.DirectionTypeプロパティを使用してチャートの目盛りラベル方向を変更する機能を提供します。TickLabels.DirectionTypeプロパティは、ChartTextDirectionType列挙値を受け入れます。ChartTextDirectionType列挙は、以下のメンバーを提供します。

次の画像は、ソースファイルと出力ファイルを比較したものです。

ソースファイル画像

todo:image_alt_text

出力ファイル画像

todo:image_alt_text

次のコードスニペットは、目盛りラベルの方向をROTATE_90からHORIZONTALに変更します。

サンプルコード

// 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");

ソースファイルと出力ファイルは、以下のリンクからダウンロードできます。

ソースファイル

出力ファイル