<?php //JPGRAPH 生成饼形图 require_once("jpgraph/jpgraph.php"); require_once("jpgraph/jpgraph_pie.php"); $arrData = array(19, 23, 34, 136, 50, 65, 70, 178); $arrMatch = array("一", "二", "三", "四", "五", "六", "七", "八"); $graph = new PieGraph(400, 300); $graph->SetShadow(); $graph->title->Set("第一个饼图"); $graph->title->SetFont(FF_SIMSUN,FS_BOLD); $pieplot = new PiePlot($arrData); $pieplot->SetLegends($arrMatch);//设置图例 $pieplot->SetCenter(0.5); $graph->Add($pieplot); $graph->legend->SetFont(FF_SIMSUN, FS_BOLD); $graph->Stroke('2d.png');//保存到文件 ?>