jpGraph学习——绘制3D饼形图

jopen 9年前

<?php     //XY坐标图      require_once("../src/jpgraph.php");      require_once("../src/jpgraph_pie.php");      require_once("../src/jpgraph_pie3d.php");      $data = array(0 => 3.5, 1 => 4.6, 2 => 9.1, 3 => 21.9, 4 => 42.3, 5 => 90.7, 6 => 183.5, 7 => 127.5, 8 => 61.4, 9 => 33.5, 10 => 11.5, 11 => 4.4);      //创建画布      $graph = new pieGraph(600,500);      //设置图像边界范围      $graph->img->SetMargin(30,30,80,30);      //设置标题      $graph->title->SetFont(FF_CHINESE); //--设置支持中文标题      $graph->title->Set("3D饼形图");      //得到3D饼图对象      $piePlot3d = new piePlot3d($data);      //设置图例      $piePlot3d->SetLegends(array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"));      //设置图例位置      $graph->legend->Pos(0.1,0.15,"left","center");      //将绘制好的3D饼图加入到画布中      $graph->Add($piePlot3d);      //输出      $graph->Stroke();

输出:

来自: http://my.oschina.net/u/2380669/blog/601454