目盛りラベル方向の変更
Contents
[
Hide
]
目盛りラベル方向の変更
Aspose.Cellsでは、TickLabels.DirectionTypeプロパティを使用してチャートの目盛りラベルの方向を変更する機能が提供されます。TickLabels.DirectionTypeプロパティはChartTextDirectionType列挙値を受け入れます。ChartTextDirectionType列挙は以下のメンバーを提供します。
- 水平 - 垂直 - Rotate90 - Rotate270 - スタック
次の画像は、ソースファイルと出力ファイルを比較したものです。
ソースファイル画像
出力ファイル画像
次のコードスニペットは、Rotate90から水平への目盛りラベルの方向を変更します。
サンプルコード
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-.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"); |
ソースファイルと出力ファイルは、以下のリンクからダウンロードできます。