作者dcplay01 (dcplay)
看板PHP
标题[请益] php图片显示中文
时间Mon Jan 28 17:26:39 2008
<?php
require_once("ChartDirector/lib/phpchartdir.php");
# The data for the line chart
@mysql_connect("localhost","junwi","33338888") or die("sorry");
$str = "SELECT c1.course_name,j1.grade
FROM joinclass j1
JOIN courses c1 ON j1.course_id = c1.course_id
WHERE c1.course_id LIKE '%w'
AND j1.stu_id =93101163" ;
$result = @mysql_db_query("sample",$str) or die("die");
$number = mysql_num_rows($result);
for ($i=1; $i<=$number; $i++) {
$fo = mysql_fetch_object($result);
$labels[]=$fo->course_name;
$ydata[]=$fo->grade;
}
# Create a XYChart object of size 300 x 280 pixels
$c = new XYChart(300, 280);
# Set the plotarea at (45, 30) and of size 200 x 200 pixels
$c->setPlotArea(45, 30, 200, 200);
# Add a title to the chart using 12 pts Arial Bold Italic font
$c->addTitle("Web Grade", "arialbi.ttf", 12);
# Add a title to the y axis
$c->yAxis->setTitle("Web point");
# Add a title to the x axis
$c->xAxis->setTitle("Course name");
# Add a blue (0x6666ff) 3D line chart layer using the give data
$lineLayerObj = $c->addLineLayer($ydata, 0x6666ff);
$lineLayerObj->set3D();
# Set the labels on the x axis.
$c->xAxis->setLabels($labels);
# output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
?>
结果如下:
http://www.badongo.com/pic/2800813
想在X轴上把???(中文)的地方 显示出来...不知道要改哪边@@
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.170.65.181
1F:推 JoeHorn:问题出在 GD 处理中文文字的能力。 01/29 08:20
2F:→ JoeHorn:你要会改写你用的 library ,改法可在 google 搜寻。 01/29 08:20
3F:→ JoeHorn:关键字是「GD 中文」。 01/29 08:21
4F:→ dcplay01:可是好像要修改套件的函式库... 01/29 15:21