Hi dgongdgong,
ChartDirector for C++ uses the UTF8 encoding for text strings, so it can support all unicode characters, including Chinese.
To create a chart with Chinese characters, please ensure that the text string is encoded in UTF8, and your code is using a font that can support Chinese characters.
If the Chinese characters are entered as text in the source code, and the text is not in UTF8, but in another encoding that is supported by the compiler, you can ask the compiler to compiler the text into unicode strings (wchar_t* or L strings) or MFC strings (_T strings), and then use the ChartDirector WCHARtoUTF8 or TCHARtoUTF8 to convert them to UTF8. For example:
m->addText(150, 125, WCHARtoUTF8(L"处理器"), "simsun.ttc", 15, Chart::TextColor,
Chart::BottomCenter);
Note that in the above code, I use L string (unicode string), then use WCHARtoUTF8 to convert it to UTF8. I also use "simsun.ttc" as the font, as this font supports Chinese characters. (Make sure the computer has the necessary font.)
Hope this can help.
Regards
Peter Kwan
|