Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
First, you need to define a class ChartJapaneseSettings that inherits from ChartGlobalizationSettings.
Then, by overriding the related functions, you can set the text of the chart elements in your own language.
Code example:
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
using namespace Aspose::Cells::Charts;
class ChartJapaneseSettings : public ChartGlobalizationSettings
{
public:
ChartJapaneseSettings() : ChartGlobalizationSettings() {}
U16String GetAxisTitleName() override
{
return U16String(u"\u8EF8\u30BF\u30A4\u30C8\u30EB");
}
U16String GetAxisUnitName(DisplayUnitType type) override
{
switch (type)
{
case DisplayUnitType::None:
return U16String(u"");
case DisplayUnitType::Hundreds:
return U16String(u"\u767E");
case DisplayUnitType::Thousands:
return U16String(u"\u5343");
case DisplayUnitType::TenThousands:
return U16String(u"\u4E07");
case DisplayUnitType::HundredThousands:
return U16String(u"\u0031\u0030\u4E07");
case DisplayUnitType::Millions:
return U16String(u"\u767E\u4E07");
case DisplayUnitType::TenMillions:
return U16String(u"\u5343\u4E07");
case DisplayUnitType::HundredMillions:
return U16String(u"\u5104");
case DisplayUnitType::Billions:
return U16String(u"\u0031\u0030\u5104");
case DisplayUnitType::Trillions:
return U16String(u"\u5146");
default:
return U16String(u"");
}
}
U16String GetChartTitleName() override
{
return U16String(u"\u30B0\u30E9\u30D5\u0020\u30BF\u30A4\u30C8\u30EB");
}
U16String GetLegendDecreaseName() override
{
return U16String(u"\u524A\u6E1B");
}
U16String GetLegendIncreaseName() override
{
return U16String(u"\u305E\u3046\u304b");
}
U16String GetLegendTotalName() override
{
return U16String(u"\u3059\u3079\u3066\u306E");
}
U16String GetOtherName() override
{
return U16String(u"\u305D\u306E\u4ED6");
}
U16String GetSeriesName() override
{
return U16String(u"\u30B7\u30EA\u30FC\u30BA");
}
};
In this step, you will use the class ChartJapaneseSettings you defined in the previous step.
Code example:
Workbook wb("Japanese.xls");
wb.GetSettings().GetGlobalizationSettings().SetChartSettings(new ChartJapaneseSettings());
Chart chart0 = wb.GetWorksheets().Get(0).GetCharts().Get(0);
chart0.ToImage("Output.png");
Then you can see the effect in the output image; the elements in the chart will be rendered according to your settings.
In this example, if you do not set the Japanese region for a chart, the following chart elements may be rendered in the default language, such as English.
After the above operation, you can obtain an output chart image with the Japanese region.
| Supported Elements | Value in This Example | Default Value in the English Environment |
|---|---|---|
| Axis Title Name | 軸タイトル | Axis Title |
| Axis Unit Name | 百,千… | Hundreds, Thousands… |
| Chart Title Name | グラフ タイトル | Chart Title |
| Legend Increase Name | ぞうか | Increase |
| Legend Decrease Name | 削減 | Decrease |
| Legend Total Name | すべての | Total |
| Other Name | その他 | Other |
| Series Name | シリーズ | Series |
|
|
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.