jpgraph的安裝和配置
1,官網下載 檔案包
2,解壓 檔案包
3,拷貝到你的開發環境下----注意的是:把src目錄的所有其他檔案 全部剪下到Examples檔案內,在剪下是先在Examples內建立jpgraph檔案夾(名字一定得是jpgraph,因為其功能檔案引用都是這個檔案名稱為準)
只留下docportal 和 Examples 這個2個檔案即可
4,執行你本地的環境---即可看見所有的jpgraph案例:http://localhost/Bbiao/jpgraph/Examples/
jpgraph支援語言檔案 -------- jpgraph_ttf.inc.php
// Chinese font
define("FF_SIMSUN",30);
define("FF_CHINESE",31);
define("FF_BIG5",32);
比如:
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
$datay1=array(13,8,19,7,17,6);
$datay2=array(40,5,2,7,5,25);
// Create the graph.
$graph = new Graph(350,250);
$graph->SetScale('textlin');
$graph->SetMarginColor('white');
// Setup title
$graph->title->Set(iconv("UTF-8","GB2312//IGNORE","咋地三炮,我要支援中文!")) ; //支援中文標題
$graph->title->SetFont(FF_SIMSUN,FS_BOLD,14);
// Create the first bar
$bplot = new BarPlot($datay1);
$bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT);
$bplot->SetColor('darkred');
// Create the second bar
$bplot2 = new BarPlot($datay2);
$bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT);
$bplot2->SetColor('darkgreen');
// And join them in an accumulated bar
$accbplot = new AccBarPlot(array($bplot,$bplot2));
$graph->Add($accbplot);
$graph->Stroke();
?>
既可實現php報表需求!