public function pie_chart($piedata, $legentdata, $title) { require_once 'Examples/jpgraph/jpgraph.php'; require_once 'Examples/jpgraph/jpgraph_pie.php'; require_once 'Examples/jpgraph/jpgraph_pie3d.php'; $graph = new PieGraph(800, 450); $graph->SetShadow(); $graph->title->SetFont(FF_SIMSUN, FS_BOLD, 12); // 设置中文字体 $graph->title->Set($title . "饼状图"); $graph->SetFrame(false); $p1 = new PiePlot3D($piedata); $p1->SetSize(0.4); $p1->SetCenter(0.3); $p1->SetLegends($legentdata); $p1->SetLabelMargin(10); $graph->legend->SetFont(FF_SIMSUN, FS_NORMAL); $graph->legend->Pos(0.03, 0.18, 'right', 'top'); $graph->legend->SetLayout(LEGEND_HOR); $graph->legend->SetColumns(2); $graph->legend->SetVColMargin(0); $graph->Add($p1); $graph->SetImgFormat('png', 90); $graph->Stroke(); }