SitePoint Sponsor

User Tag List

Results 1 to 16 of 16

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help needed on creating bar graphs

    hi there i want to create bar graphs from data i have stored in my database using php and mysql.

    what i would like the bar graph to show is the employee types which are booked thoughout the previous year. months and number of employee type will need to been shown on the bar graph and also the different employee type represented by different colours as the bar.

    now i have know idea on how to do this although i have heard of GD library but do not know how it all works. i have downloaded the GD tool but i can not install it.

    I was hoping that someone can give some guidance.

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Most people who comment on this seem to tend towards using google graphs, and rate them very highly.

    GD is processor intensive as I understand it.

  3. #3
    SitePoint Guru mmarif4u's Avatar
    Join Date
    Dec 2006
    Location
    /dev/swat
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are a lot of charting softwares available, i am using two of them.
    one is Open flash charts. 2nd is chart director(not free, but can use it as trail). All support MySQL and PHP. Both are easy to integrate with MySQL tables and data.
    Links to the sites:
    Open Flash Charts
    Chart Director

    Chart Director can do real charting too. and create images for charts, so you can use it later.

    Hope it helps.

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.aditus.nu/jpgraph/

    You'll have to get comfy with the manual.

  5. #5
    SitePoint Wizard silver trophy
    beley's Avatar
    Join Date
    May 2001
    Location
    LaGrange, Georgia
    Posts
    6,117
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I'm surprised in the PHP forum no one has suggested pChart. I think it uses GD library, but is a really simple set of classes - you just provide the formatting information and data and it does the rest. The graphs look pretty good!

  6. #6
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pChart is nice! I guess that I've been using jpgraph for so long that I never bothered to look for alternatives.

    EDIT: Maybe I spoke too soon. It isn't as customizable as I would have wanted.

  7. #7
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by faz000 View Post
    now i have know idea on how to do this although i have heard of GD library but do not know how it all works. i have downloaded the GD tool but i can not install it.

    I was hoping that someone can give some guidance.
    PHP installing GD should get you started, let us know which OS you cannot install it on, and at which step you have problems from the tutorials/posts/faqs found in that google search.

    Try and be specific.

  8. #8
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi in my php file i have done:
    extension_dir = "C:\php\ext"

    i have taken out the line semicolons for
    extension=php_gd2.dll
    extension=php_bz2.dll
    and i do have a file in my extenstions folder saying gd_2.dll....something like that

    when i try to test if gd will work i.e. by creating php file
    <?php
    var_dump(gd_info());
    ?>
    i try to open the php page in my browser but it opens the file from my c drive in macromedia.

    i do not know what to do help please!

  9. #9
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to install a web server and view the page through that.

    XAMPP will automatically set that up for you:
    http://www.apachefriends.org/en/xampp.html

    Or you can upload to your web host.

  10. #10
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i already have apache

  11. #11
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    In your browser address bar type;

    127.0.0.1

    or

    http://localhost/

    That should serve a page from your servers document root, you then need to find where that is on your hdd, stick your gd test php file in that folder, lets say its a file called gd_test.php, then go to

    127.0.0.1/gd_test.php

    or

    http://localhost/gd_test.php
    Last edited by Cups; Nov 16, 2008 at 12:31. Reason: clarified it was a file I was talking about.

  12. #12
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats exactly what i did: http://localhost/gd_infor.php
    and it does not work but where ever i have a html page to open it works. or where i have a html page sending data to php page it works

  13. #13
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    So, does your server know what to do with PHP pages I wonder?

    Try this, make a page called php_info.php

    <?php

    phpinfo();

    ?>

    Now, what does that say?

  14. #14
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that works fine

  15. #15
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey, i tried it again i think its worked
    array(12) { ["GD Version"]=> string(27) "bundled (2.0.34 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["T1Lib Support"]=> bool(true) ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(false) ["XBM Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) }

    its showing all this stuff

  16. #16
    SitePoint Wizard Young Twig's Avatar
    Join Date
    Dec 2003
    Location
    Albany, New York
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This probably isn't what you're looking for, but you can also make really basic bar graphs with straight CSS:
    PHP Code:
    <div class="bar" style="width: <?php echo $width ?>%"><?php echo $width ?>%</div>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •