php Jpgraph绘制柱形图

[php] view plain copy print ?
  1. <?php  
  2. include ("src/jpgraph.php");  
  3. include ("src/jpgraph_bar.php");  
  4.   
  5. $data = array(19,23,34,38,45,67,71,78,85,87,90,96);         //定义数组  
  6.   
  7. $graph = new Graph(400,300);                                //创建新的Graph对象  
  8. $graph->SetScale("textlin");                                  
  9.   
  10. $graph->SetShadow();                                       //设置阴影  
  11.   
  12. $graph->img->SetMargin(40,30,20,40);                        //设置边距  
  13.   
  14. $barplot = new BarPlot($data);                              //创建BarPlot对象  
  15.   
  16. $barplot->SetFillColor('blue');                              //设置颜色  
  17. $barplot->value->Show();                                          //设置显示数字  
  18. $graph->Add($barplot);                                               //将柱形图添加到图像中  
  19.   
  20. $graph->title->Set("年度收支表");                                      //设置标题和X-Y轴标题  
  21. $graph->xaxis->title->Set("月份");  
  22. $graph->yaxis->title->Set("总金额(兆美元)");  
  23.   
  24. $graph->title->SetFont(FF_SIMSUN,FS_BOLD);                            //设置字体  
  25. $graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD);  
  26. $graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD);  
  27.   
  28. $graph->Stroke();  
  29. ?>  

php Jpgraph绘制柱形图_第1张图片

你可能感兴趣的:(PHP,PHP,代码,绘图,jpgraph,柱形图)