Node.jsとC++を使用したティックラベルの方向変更方法

目盛りラベル方向の変更

Aspose.Cellsは、TickLabels.getDirectionType()プロパティを使用してチャートのティックラベルの向きを変更する機能を提供します。TickLabels.getDirectionType()プロパティはChartTextDirectionType列挙値を受け入れます。ChartTextDirectionType列挙には次のメンバーが含まれます:

- 水平 - 垂直 - Rotate90 - Rotate270 - スタック

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

ソースファイル画像

todo:image_alt_text

出力ファイル画像

todo:image_alt_text

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

サンプルコード

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// The path to the documents directory.
const sourceDir = path.join(__dirname, "data");
const outputDir = path.join(__dirname, "output");
const filePath = path.join(sourceDir, "SampleChangeTickLabelDirection.xlsx");

// Loads the workbook which contains hidden external links
const workbook = new AsposeCells.Workbook(filePath);

const worksheet = workbook.getWorksheets().get(0);

// Load the chart from source worksheet
const chart = worksheet.getCharts().get(0);

chart.getCategoryAxis().getTickLabels().setDirectionType(AsposeCells.ChartTextDirectionType.Horizontal);

// Output the file
workbook.save(path.join(outputDir, "outputChangeChartDataLableDirection.xlsx"));

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

ソースファイル

出力ファイル