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.
DEMO:
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)



#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 ;)
#3 by Bobby on December 14, 2009 - 12:27 PM
I’m sorry, but scaling example simply doesn’t work!
Test it, man!
#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
#5 by peer imran ali on February 21, 2010 - 11:11 AM
Thanx
Nice article.
#6 by Financial Crisis on June 25, 2010 - 2:27 AM
very cool bar graphs, than you
#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