NAME
Apache::GD::Graph - Generate Charts in an Apache handler.
SYNOPSIS
In httpd.conf:
PerlModule Apache::GD::Graph
<Location /chart>
SetHandler perl-script
PerlHandler Apache::GD::Graph
</Location>
Then send requests to:
http://www.your-server.com/chart?type=lines&x_labels=1st,2nd,3rd,4th,5th&data1=1,2,3,4,5&data2=6,7,8,9,10
DESCRIPTION
This is a simple Apache mod_perl handler that generates and returns a png format graph based on the arguments passed in via a query string. It responds with the content-type "image/png" directly, and sends a Expires: header of 30 days ahead (since the same query string generates the same graph, they can be cached). In addition, it keeps a server-side cache under /tmp/graph-(PID) for the lifetime of the Apache process. (These are safe to periodically clean out with a cron job).
OPTIONS
- type
-
Type of graph to generate, can be lines, bars, points, linespoints, area, mixed, pie. For a description of these, see GD::Graph(3).
- width
-
Width of graph in pixels.
- height
-
Height of graph in pixels.
For the following three, look at the plot method in GD::Graph(3).
- x_labels
-
Labels used on the X axis, the first array given to the plot method of GD::Graph.
- dataN
-
Values to plot, where N is a number starting with 1. Can be given any number of times with N increasing.
ALL OTHER OPTIONS are passed as a hash to the GD::Graph set method.
AUTHOR
Rafael Kitover (caelum@debian.org)
COPYRIGHT
This program is Copyright (c) 2000 by Rafael Kitover. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
BUGS
Probably a few.
TODO
Configuration of cache dirs, value of the expires header and other options via PerlSetEnv directives in httpd.conf.
Let me know.