网站首页 > 服务器教程 > linux服务器 > ChartDirector Linux下中文显示问题

ChartDirector Linux下中文显示问题

  • 作者:互联网
  • 时间:2009-06-04 17:52:24

用ChartDirector 制作走势图显示中文时,在Windows下是可以正常显示的阿,放到Linux环境下就是显示为[方框],解决方法如下:

程式:

以下为引用的内容:

// Create a XYChart object of size 700 x 450 pixels
XYChart c = new XYChart(700, 450);

// Set the plotarea at (30, 20) and of size 200 x 200 pixels
c.***PlotArea(120, 70, 520, 270);

// Add a line chart layer using the given data
c.***LineLayer(data, -1, "XXXX 走势图");

// Display 1 out of 3 labels on the x-axis.
c.xAxis().setLabelStep(1);

c.***Background(0xFFFF80, 0x0, 1);
c.***PlotArea(120, 70, 520, 270, 0xFFFFFF, -1, -1, 0xC0C0C0, -1);

c.***Legend(400, 35, false, "si***n.ttc", 10).setBackground(0xFFFF80);
 

其中 【si***n.ttc】 是此程式中使用的中文字型名称。

问题原因:

Linux 下无 【si***n.ttc】 此字型档。

问题解决:

从 Windows 系统将 【si***n.ttc】 此档案复制到专案的JavaSource 下,重新打包,重新发布,重新启动 Server。

或从 Windows 系统将 【si***n.ttc】 此档案复制到专案的【专案目录】/WEB-INF/classes 下,重新启动 Server。