コメント |
キャラクタセットは、EUC-JP で記述しています
http://lightbox.on.coocan.jp/image/example18.png
@DIV
<?php
set_include_path( "/user/php/jpgraph-1.21b/src" );
include ("jpgraph.php");
include ("jpgraph_bar.php");
$datay=array(12,8,19,3,10,5);
// Create the graph. These two calls are always required
$graph = new Graph(300,200,"auto");
$graph->SetScale("textlin");
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->img->SetMargin(40,30,20,40);
// Create a bar pot
$bplot = new BarPlot($datay);
$graph->Add($bplot);
// Setup the titles
// 内部コード設定
mb_language( "ja" );
mb_internal_encoding("EUC-JP");
// UTF-8 に変換
$str = "シンプル棒グラフ";
$str = mb_convert_encoding ( $str, "UTF-8" );
$graph->title->Set( $str );
$graph->xaxis->title->Set( mb_convert_encoding ( "x 座標", "UTF-8" ) );
$graph->yaxis->title->Set( mb_convert_encoding ( "y 座標", "UTF-8" ) );
// フリーフォントの指定
$graph->title->SetFont(FF_GOTHIC);
$graph->yaxis->title->SetFont(FF_GOTHIC);
$graph->xaxis->title->SetFont(FF_GOTHIC);
// Display the graph
$graph->Stroke();
?>
@END
|