PHP Bar Graph / Bar Chart


This script allows you to create a simple dynamic horizontal PHP bar graph / bar chart from session data. With labels, colours, and many other customisable features. Great if you just want a simple PHP chart with no fuss.

Customisable Features:

  • Bar Colour
  • Bar Height
  • Grid Space
  • Title
  • Footer

The demo randomly customises itself, so refresh this page a few times to see what it can do.

Download PHP Source

DEMO:
PHP Bar Chart

If you use or modify the graph, please either email me about any modifications you make, or post a comment here with feedback about usability – bugs, feature requests etc, cheers :-)

Mega-Squall has modified the code to include two types of scaling; check it out @ http://ledry.free.fr/phpgraph/ – thanks!
(local copy here)

Bookmark and Share


Related Posts:

, , ,

  1. #1 by Sean on May 5, 2009 - 6:32 PM

    Your script has one major downside that makes it pretty much unusable for most applications…. Have you tried to show maybe a figure of 25,000 for one of your bars and see how big the image gets?? Not sure a 2500pixel wide image is going to be ideal for a web page 1024 pixels wide huh ;) Otherwise good starting concept..

    • #2 by user24 on May 6, 2009 - 4:15 AM

      I believe Mega-Squall’s improved code deals with exactly that situation by allowing scaling of the graph ;)

  2. #3 by Bobby on December 14, 2009 - 12:27 PM

    I’m sorry, but scaling example simply doesn’t work!

    Test it, man!

  3. #4 by qwaszx on February 11, 2010 - 2:18 AM

    Hi,

    Your graph is fantastic. I made some changes such as the size of the image, I deleted random color generator and random size.
    I am taking data from my sql db and it works.

    Thanks

  4. #5 by peer imran ali on February 21, 2010 - 11:11 AM

    Thanx
    Nice article.

  5. #6 by Financial Crisis on June 25, 2010 - 2:27 AM

    very cool bar graphs, than you

  6. #7 by seyi on August 12, 2010 - 10:24 AM

    @qwaszx ……….pls aw did u get ur data from mysql db…..mine dosent seem to work

(will not be published)