#native_company# #native_desc#
#native_cta#

HTML_Graphs

By Tim Perdue
on July 30, 2000

When I compiled PHP on my LinuxPPC box, I didn’t have GD installed and
didn’t want to add another layer of complexity by compiling it in. GD
will let you do all kinds of cool things – creating gifs, complex charts, etc,
if you use libraries from the Sample Code Archive here on this site and PHP’s
built in functionality.
I didn’t want the lack of GD to stifle me too much, so I started hunting around
for a way to generate html-based graphs and charts. Fortunately, someone
had already gone to the trouble of writing up a class to handle that.
at
WebGuys
provided a nifty class called HTML_Graphs.
At first, I was a little taken back by the complexity of the class. It does
all kinds of things, from vertical bar charts to multiple horizontal bar charts.
Because I knew I was going to use the class a lot, I spent some time creating a
couple of wrapper functions.
Many of the functions of the class don’t need to be used for basic graphing,
which is what I am showing here. For instance, I don’t see any need to
go into detail on creating multiple charts at once. And vertical charts
are created as easily as horizontal charts – just change the “type” parameter
in the GraphIt() function that I detail elsewhere.
So let’s get started. I will at first lay out the functions I have written,
and then we’ll talk about a specific use for them.

1
|
2
|
3
|
4