Article Title: solves the problem of displaying Chinese Characters in ChartDirectorLinux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
When ChartDirector is used to create a chart to display Chinese characters, it can be displayed normally in Windows. In Linux, it is displayed as a [Box]. The solution is as follows:
Program
// Create a XYChart object of size 700x450 pixelsXYChart c = new XYChart (700,450); // Set the plotarea at (30, 20) and of size 200x200 pixelsc. setPlotArea (120, 70,520,270); // Add a line chart layer using the given datac. addLineLayer (data,-1, "XXXX trend chart"); // Display 1 out of 3 labels on the x-axis.c.xAxis (). setLabelStep (1); c. setBackground (0xFFFF80, 0x0, 1); c. setPlotArea (120, 70,520,270, 0 xFFFFFF,-1,-1, 0xC0C0C0,-1); c. addLegend (400, 35, false, "simsun. ttc ", 10 ). setBackground (0xFFFF80 ); |
Simsun. ttc is the Chinese font name used in this program.
Cause:
In Linux, the [simsun. ttc] font file does not exist.
Solution:
Copy the [simsun. ttc] file from the Windows system to JavaSource of the project, repackage it, release it again, and restart the Server.
Or copy the simsun. ttc file from Windows to the project directory/WEB-INF/classes to restart the Server.