[PHP-users 14055] Re: JPGraphの日本語表示について

017102 熊谷 悟 php-users@php.gr.jp
Tue, 18 Mar 2003 11:43:53 +0900


今までの流れでWin32環境でJPGraph1.11を使用して,
日本語を表示させるところまでは出来ております.

ただちょっと話がそれるかもしれませんが,私が参考にしている
青マンモス本のサンプルを実行した場合に,ページのタイトルなどは
どこの部分で設定することになるのでしょうか?
私が今現在テストしているコードは
<?php 
require_once("/jpgraph.php");
require_once("/jpgraph_line.php");
$labels = array('2000/1','2000/7','2001/1','2001/7','2002/1');
$domains = array(1200000,3100000,5100000,7000000,7500000); 
$ipadrs = array(  350000, 600000, 800000, 950000,1100000); 
$graph = new Graph(300,250,"auto");
$graph->SetScale("textlin");
$graph->img->SetMargin(60,40,40,60);
$graph->img->SetAntiAliasing(); 
$graph->SetShadow();
$graph->title->Set(mb_convert_encoding("PHPユーザー推移グラフ
","UTF-8","SJIS"));
$graph->title->SetFont(FF_MINCHO,FS_NORMAL,14);
$graph->xaxis->SetTickLabels($labels);
$graph->xaxis->SetFont(FF_MINCHO,FS_NORMAL,14);
$graph->xaxis->SetLabelAngle(45);
$line1 = new LinePlot($domains);
$line1->mark->SetType(MARK_FILLEDCIRCLE);
$line1->mark->SetFillColor("green");
$line1->mark->SetWidth(3);
$line1->SetColor("blue");
$line1->SetCenter();
$line1->SetLegend("Domains");
$line2 = new LinePlot($ipadrs);
$line2->mark->SetType(MARK_UTRIANGLE);
$line2->mark->SetFillColor("green");
$line2->mark->SetWidth(3);
$line2->SetColor("red");
$line2->SetCenter();
$line2->SetLegend("IP");
$graph->legend->SetLayout(LEGEND_VERT);
$graph->legend->Pos(0.8,0.5,"center","center");
$graph->Add($line1);
$graph->Add($line2);
$graph->Stroke();   //グラフを出力
?>
ですが,最後の行でグラフを出力しているため,てっきり単純に
print("<html>\n");
print("<head>\n");
print("<title>Test_Graph</title>\n");
print("</head>\n");
print("<body>\n");
$graph->Stroke();
print("</body>\n");
print("</html>\n");
とすればよいと思っていたのですが,jpgraph.phpでエラーが発生します.

いろいろ調べましたが,書籍や他のサイトのサンプルを見ると
ページのタイトルが全てhttp://hoge/test.phpのように実行ファイル名が
タイトルになっています.
よほど基本的なことなのかもしれませんが,お分かりになる方が
いらっしゃいましたらご指導願います.