Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.Cells APIs have exposed the ChartGlobalizationSettings class in order to deal with the scenarios where the user wishes to set chart component to different language. custom labels for Subtotals in a spreadsheet.
The ChartGlobalizationSettings class currently offers the following 8 methods which can be overridden in a custom class to translate such as AxisTitle name, AxisUnit name, ChartTitle name and so on to different language.
Here, we will create a waterfall chart based on the following data. The names of chart components will be displayed in English in the chart. We will use a Turkish language example to show how to display the Chart Title, Legend Increase/Decrease names, Total name, and Axis Title in Turkish.

The following sample code loads the sample Excel file.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
using namespace Aspose::Cells::Charts;
class TurkeyChartGlobalizationSettings : public ChartGlobalizationSettings
{
public:
TurkeyChartGlobalizationSettings() : ChartGlobalizationSettings() {}
U16String GetChartTitleName() override
{
return u"Grafik Başlığı"; // Chart Title
}
U16String GetLegendIncreaseName() override
{
return u"Artış"; // Increase
}
U16String GetLegendDecreaseName() override
{
return u"Düşüş"; // Decrease
}
U16String GetLegendTotalName() override
{
return u"Toplam"; // Total
}
U16String GetAxisTitleName() override
{
return u"Eksen Başlığı"; // Axis Title
}
};
void ChartGlobalizationSettingsTest()
{
// Create an instance of existing Workbook
U16String pathName = u"input.xlsx";
Workbook workbook(pathName);
// Set custom chartGlobalizationSettings, here is TurkeyChartGlobalizationSettings
TurkeyChartGlobalizationSettings* globalizationSettings = new TurkeyChartGlobalizationSettings();
workbook.GetSettings().GetGlobalizationSettings()->SetChartSettings(globalizationSettings);
// Get the worksheet
Worksheet worksheet = workbook.GetWorksheets().Get(0);
// Load the chart from source worksheet
ChartCollection chartCollection = worksheet.GetCharts();
Chart chart = chartCollection.Get(0);
// Chart Calculate
chart.Calculate();
// Get the chart title
Title title = chart.GetTitle();
// Output the name of the Chart title
std::cout << "\nWorkbook chart title: " << title.GetText().ToUtf8() << std::endl;
// Get the legend labels
Vector<U16String> legendEntriesLabels = chart.GetLegend().GetLegendLabels();
// Output the name of the Legend
for (int i = 0; i < legendEntriesLabels.GetLength(); i++)
{
std::cout << "\nWorkbook chart legend: " << legendEntriesLabels[i].ToUtf8() << std::endl;
}
// Output the name of the Axis title
Title categoryAxisTitle = chart.GetCategoryAxis().GetTitle();
std::cout << "\nWorkbook category axis title: " << categoryAxisTitle.GetText().ToUtf8() << std::endl;
delete globalizationSettings;
}
int main()
{
Aspose::Cells::Startup();
ChartGlobalizationSettingsTest();
Aspose::Cells::Cleanup();
return 0;
}
This is the console output of the above sample code.
Workbook chart title: Grafik Başlığı
Workbook chart legend: Artış
Workbook chart legend: Düşüş
Workbook chart legend: Toplam
Workbook category axis tile: Eksen BaşlığıAnalyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.