Online Shopping : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

45 of 59 people (76%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

Is there a PHP library for drawing graphs?
Is there a PHP library for drawing charts?

Oct 31st, 2004 21:53
Philip Olson, Praveen Kumar Kukkapalli, Alder Rus, A Ottenheimer, Chris Kings-Lynne, Nathan Wallace,


Apart from all these JPGraph is providing so many kinds of graphs like 
bar graph, Pie chart, ad many more. It is free for personal usage and 
charging few $ for commercial use. Overall this is very good ad simple.
You can find about it at http://www.aditus.nu/jpgraph
If you are looking for a free graph and chart class that 
works with PHP3, PHP4, gd 1.2 - gd 1.3.8, and has TTF
support, there is PHPLOT at
    http://www.jeo.net/php/phplot/
it has also been released on sourceforge in CVS at 
    http://www.sourceforge.com/projects/phplot/
There is a commercial class at:
    http://www.vhconsultants.com/graph/graph.htm
An example usage of this class is given below.  Be sure not to include
any white space before this PHP code segment.
    <?php
    include ("class.graph");
    $a = array(
        array("Jan.","Feb.","March","April","May","June"),
        array(1.3,1.8,2.3,1.8,1.9,2.4),
        array(1.0,2.1,2.0,1.3,2.3,2.0) );
    phpplot(array(
        "box_showbox"=> true,
        "grid"=> true,
        "cubic"=> true,
        "title_text"=> "Bar Graph",
        "yaxis_labeltext"=> "Revenue (in million $)",
        "xaxis_labeltext"=> "Months",
        "legend_shift"=> array(-300,10),
        "size"=> array(400,250) ));
    phpdata($a);
    phpdraw(bargraph,
        array(
            "drawsets" => array(1,2),
            "legend"=> array("First Half Revenue",
            "Last Year Result"),
        "barspacing"=> 8,
        "showvalue"=> false ));
    phpshow();
    ?>
OR
WebGuys have a bar graph generator that creates purely HTML-based 
graphs:
http://www.webguys.com/pdavis/Programs/html_graphs/
or
http://www.phpbuilder.com/columns/tim19990812.php3