作者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
推 JoeHorn:問題出在 GD 處理中文文字的能力。 01/29 08:20
→ JoeHorn:你要會改寫你用的 library ,改法可在 google 搜尋。 01/29 08:20
→ JoeHorn:關鍵字是「GD 中文」。 01/29 08:21
→ dcplay01:可是好像要修改套件的函式庫... 01/29 15:21