Introduction: This is a detailed page of The jpgraph bar graph instance for PHP reports. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 345301 'rolling = 'no'>
Jpgraph is a very powerful third-party reporting tool in PHP. It is said that it can complete all the graphics you want...
When a newbie first learns about jpgraph, he will certainly encounter various problems, such as gibberish. This case is made in jpgraph3.0.7 and has been tested several times to solve the garbled problem.
<? PHP
$ Datay = array (); // ordinate data
$ Datax = array (); // X-axis data
Foreach ($ usernums as $ key => $ value ){
$ Datay [] = $ value;
$ Datax [] = $ userids [$ key];
}
Require_once ('jpgraph-3.0.7/jpgraph. php ');
Require_once ('jpgraph-3.0.7/jpgraph/jpgraph_bar.php ');
// Create the graph. These two cballs are always required
$ Graph = New Graph (800,600); // High Image Width
$ 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", "user consumption report diagram "));
$ Graph-> xaxis-> title-> set ("UTF-8", "gb2312", "user name "));
$ Graph-> yaxis-> title-> set ("UTF-8", "gb2312", "user order quantity "));
$ 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 ();
?>
:
Jpgraph: http://down.qiannao.com/space/file/bingxingke/share/2010/6/29/jpgraph-002d3.0.7.tar.gz/.page
From: http://www.52blogger.com/archives/539
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/345301.html pageno: 4.