不错的php图形类库 – JPGraph

最近在用一个非常不错的php图形类库-JPGraph,来给各种统计数据绘图,感觉非常好用和强大,可以画各种统计图和曲线,也可以自定义展示颜色和字体等展示元素,和大家分享一下吧,下载地址如下:
http://download.chinaunix.net/download/0006000/5098.shtml

顺便附一个用jpgraph画柱状图的例子:

  1. include ("./graph/jpgraph.php");
  2. include ("./graph/jpgraph_bar.php");
  3.  
  4. $graph = new Graph(600,250,"auto");
  5. $graph->img->SetMargin(50,20,30,65);
  6. $graph->SetScale("textlin");
  7. $graph->SetShadow();
  8. $graph->title->Set("");
  9.  
  10. // Slightly adjust the legend from it's default position
  11. $graph->legend->SetLayout(LEGEND_HOR);
  12. $graph->legend->Pos(0.5,0.95,"center","bottom");
  13. $graph->legend->SetFont(FF_FONT1,FS_BOLD);
  14.  
  15. // Setup X-scale
  16. $graph->xaxis->SetTickLabels($xscal);//x坐标赋值
  17. $graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);//x坐标显示字体
  18. $graph->xaxis->SetLabelAngle(0);//x坐标显示角度
  19.  
  20. $bar = new BarPlot($speedArr);//赋值给柱状图
  21. $bar->SetFillColor("orange");//柱状图填充颜色
  22. $bar->value->Show();
  23.  
  24. $graph->Add($bar);
  25. // Output line
  26. $graph->Stroke();
Comments
2 Responses to “不错的php图形类库 – JPGraph”
  1. Andrew says:

    楼上的真是敬业啊!!!admire~

Leave A Comment

Bad Behavior has blocked 949 access attempts in the last 7 days.