Tick Etiket Yönünü C++ ile Değiştir

Tick Etiketi Yönünü Değiştirme

Aspose.Cells, diyagram tik etiketi yönünü TickLabels.GetDirectionType() özelliği kullanarak değiştirme imkanı sağlar. TickLabels.GetDirectionType() özelliği, ChartTextDirectionType enumeration değerini kabul eder. ChartTextDirectionType enumeration aşağıdaki üyeleri sağlar:

  • Yatay
  • Dikey
  • 90 Derece Döndür
  • 270 Derece Döndür
  • Yığınlanmış

Aşağıdaki resim kaynak ve çıktı dosyalarını karşılaştırmaktadır:

Kaynak dosya görüntüsü

todo:image_alt_text

Çıktı dosyası görüntüsü

todo:image_alt_text

Aşağıdaki kod parçacığı, işaret etiket yönünü Rotate90’dan Yatay’a değiştirir.

Örnek Kod

#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C

    // Directory source and output paths
    U16String sourceDir(u"..\\Data\\01_SourceDirectory\\");
    U16String outDir(u"..\\Data\\02_OutputDirectory\\");

    // Create workbook and load the sample Excel file
    Workbook workbook(sourceDir + u"SampleChangeTickLabelDirection.xlsx");

    // Obtain the first worksheet
    Worksheet worksheet = workbook.GetWorksheets().Get(0);

    // Load the chart from the source worksheet
    Chart chart = worksheet.GetCharts().Get(0);

    // Set the category axis tick labels direction to Horizontal
    chart.GetCategoryAxis().GetTickLabels().SetDirectionType(ChartTextDirectionType::Horizontal);

    // Output the modified workbook to a new file
    workbook.Save(outDir + u"outputChangeChartDataLableDirection.xlsx");

    std::cout << "Chart tick label direction changed successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}

Kaynak ve çıktı dosyaları aşağıdaki linklerden indirilebilir.

Kaynak Dosya

Çıktı Dosyası