北京网站建设优点体现-php报表之jpgraph柱状图实例

--------

北京网站建设优点体现

-------

  jpgraph是php中一个十分十分强劲的第三方表格专用工具,听说能进行一切你想要的图型

新手初识jpgraph毫无疑问会遇到各种各样各种各样的难题,例如错码甚么的,本实例是jpgraph3.0.7制作,也历经自己的数次试验,处理错码难题

$datay=array(); //纵座标数据信息

$datax=array(); //横座标数据信息

foreach ($usernums as $key = $value){

$datay[] = $value;

$datax[] = $userids[$key];

}

require_once ( jpgraph-3.0.7/ );

require_once ( jpgraph-3.0.7/ );

// Create the graph. These two calls are always required

$graph = new Graph(800,600); //图象高宽

$graph- SetScale( textlin );

$graph- xaxis- SetTickLabels($datax);

$graph- xaxis- SetFont(FF_VERDANA,FS_NORMAL,10);

$graph- xaxis- SetLabelAngle(30);

$graph- yaxis- scale- SetGrace(20);

$graph- xaxis- scale- SetGrace(20);

// Add a drop shadow

$graph- SetShadow();

// Adjust the margin a bit to make more room for titles

$graph- img- SetMargin(40,30,20,40);

// Create a bar pot

$bplot = new BarPlot($datay);

// Adjust fill color

$bplot- SetFillColor( orange );

$bplot- value- Show();

$bplot- value- SetFont(FF_ARIAL,FS_BOLD,10);

$bplot- value- SetAngle(45);

$bplot- value- SetFormat( %d );

$graph- Add($bplot);

// Setup the titles

$graph- title- Set(iconv( UTF-8 , gb2312 , 客户消费表格图 ));

$graph- xaxis- title- Set(iconv( UTF-8 , gb2312 , 客户名字 ));

$graph- yaxis- title- Set(iconv( UTF-8 , gb2312 , 客户定单数量 ));

$graph- xaxis- title- SetFont(FF_SIMSUN,FS_BOLD);

$graph- yaxis- title- SetFont(FF_SIMSUN,FS_BOLD);

$graph- title- SetFont(FF_SIMSUN,FS_BOLD);

// Display the graph

$graph- Stroke();

?

实际效果图:

---------

北京网站建设优点体现

------------