Ändern Sie die Richtung der Tick Beschriftung mit Node.js über C++

Ändern der Richtung der Markierungstexte

Aspose.Cells bietet die Möglichkeit, die Richtung der Diagramm-Tick-Labels mit der TickLabels.getDirectionType() Eigenschaft zu ändern. Die TickLabels.getDirectionType() Eigenschaft akzeptiert den ChartTextDirectionType Enumeration-Wert. Das ChartTextDirectionType Enumeration bietet die folgenden Mitglieder:

  • Horizontal
  • Vertikal
  • Drehen90
  • Drehen270
  • Gestapelt

Das folgende Bild vergleicht die Quell- und Ausgabedateien

Quelldateibild

todo:image_alt_text

Ausgabedateibild

todo:image_alt_text

Der folgende Code-Schnipsel ändert die Richtung der Tickbeschriftung von Rotate90 auf Horizontal.

Beispielcode

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

Die Quell- und Ausgabedateien können von den folgenden Links heruntergeladen werden.

Quelldatei

Ausgabedatei