Hey I want to draw a graph(Stdent mark distribution) in my site based on PHP. How can I do this?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
pChart is another great PHP graphing library.
By far the easiest solution is to just use the Google Chart API http://code.google.com/apis/chart/
You can make bar graphs, pie charts, use 3D, and it's as easy as building a url with some parameters. See the simple example below.
Have no idea about gd2, but I have done a similar thing with gd and it was not that hard.
Go to http://www.php.net/ and search for things like
It's not as flashy as some of those other solution out there, but since you generate a picture it will work in all browsers. (except lynx... :-) )
/Johan
Update: I nearly forgot, don't use jpeg for this type of pictures. The jpeg artefacts will be really annoying, png is a better solution.
You can use google's chart api to generate charts.
Your best bet is to look up php_gd2. It's a fairly decent image library that comes with PHP (just disabled in php.ini), and not only can you output your finished images in a couple formats, it's got enough functions that you should be able to do up a good graph fairly easily.
EDIT: it might help if I gave you a couple useful links:
http://www.libgd.org/ - You can get the latest
php_gd2
herehttp://ca3.php.net/gd - The
php_gd
manual.