Chapter 6. Charts and Graphs with GIFgraph

GIFgraph is a Perl module that expands on the capabilities of GD by offering a number of methods for creating graphs and charts. For quite a while, almost all of the financial graphs or web server load graphs seen on the Web were generated by GIFgraph. Now, as more money gets pumped into the back end of many web sites, companies are spending tens of thousands of dollars on customized proprietary graphing and charting packages that in some cases don’t really go that much farther than the freely redistributable GIFgraph module.

In this chapter we’ll implement a web biorhythms server, provide a reference to the GIFgraph methods and attributes controlling the various types of graph layouts, show how the Data::Xtab module can be used to make it easier to get real-world data into a format suitable for use with GIFgraph, and go through an example of “passing off” a GIFgraph graph to another image manipulation package such as GD.

The GIFgraph package was written by Martien Verbruggen, and is available on CPAN. It should run on any operating system that runs Perl and the GD module, which it uses for all of its drawing and file primitives. Since not all ports of GD behave correctly (for example, some older ports on Win32), be sure that you have a proper version of Perl (such as Gurusamy Sarathy’s Win32 port) and GD 1.15 or higher.

Let’s Make Some Graphs!

Constructing graphs with GIFgraph can be broken down into three phases. First you will need to ...

Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.