Internally, ChartDirector uses Unicode to handle text. It fully supports international characters (that is, non-English and non-ASCII characters).
For ChartDirector to draw an international character in an image, it must use the proper fonts. By default, ChartDirector uses the
Arial font. If the
Arial font does not contain characters you want to display, you may need to specify an alternative font that contains the characters you need.
You may change the default font by using
BaseChart.setDefaultFonts or
DrawArea.setDefaultFonts. ChartDirector API also allows changing the fonts in some particular text labels in the chart. For example, you may use the
BaseChart.addTitle to specify the font for the chart title. Finally, you may use the
ChartDirector Mark Up Language to specify the font used for any text.
If you are using international characters as string literals in your source code, please make sure your programming language interpreter or compiler can understand the encoding of the international characters.
On a web environment, note that even if a web server can serve international web pages correctly, it does not mean that the the web server understands international characters. It may simply pass the characters transparently to the browser. For plain HTML web pages, only the browser needs to understand international characters and have the correct international fonts, not the server.
On the other hand, for ChartDirector applications, charts are rendered on the server side. Therefore, the server needs to understand the international characters and have the proper fonts installed, while there is no particular requirement for the browser. You may need to use the pageEncoding attribute of the @page directive to ensure your JSP understands your encoding. For example:
<%@page import="ChartDirector.*" pageEncoding="Big5"%>
For standalone applications, you may need to use the "-encoding" flag of the "javac" compiler to ensure the compiler understands your encoding.
In ChartDirector, the decimal point, thousand separator and the names used for months, weekdays, etc., are all configurable.
For example, instead of using "." as the decimal point, you may configure ChartDirector to use "," as the decimal point using
BaseChart.setNumberFormat, or by using
Parameter Substitution and Formatting.
Similarly, instead of using "Sun", "Mon", "Tue", ... etc, for the weekday names in date formatting, you may use
BaseChart.setWeekDayNames to supply another set of names. The same applies to month names using
BaseChart.setMonthNames, and to AM/PM representation using
BaseChart.setAMPM.
© 2021 Advanced Software Engineering Limited. All rights reserved.