Apache-GDGraph
view release on metacpan or search on metacpan
- Boxed captions in plain/dashed/dotted/whatever style.
- Support builtin GD fonts Like gdSmallFont.
- Cleaner code and misc. minor bugs fixed.
0.92 Tue Apr 24 11:36:19 PDT 2001
- Previous versions couldn't handle more than 9 arguments because of a
silly string increment bug :) Thanks to Drew Degentesh for pointing
this out.
0.91 Tue Feb 6 16:37:56 PST 2001
- Added a background_image option to make it simpler to add background
images to graphs.
- Added no_axes parameter.
- Added PerlSetVar TTFFontPath to set the path to search for True Type
fonts in GD::Text, and consequently any font related methods in
GD::Graph.
- Fixed another minor caching snafu (PerlSetVar CacheSize 0 still
checked for cached images).
- Expanded pod docs a bit.
- Fixed exceptions, for the last time I hope.
- Added support for captions at arbitrary locations in the graph, with
at time of writing:
white, lgray, gray, dgray, black, lblue, blue, dblue, gold, lyellow,
yellow, dyellow, lgreen, green, dgreen, lred, red, dred, lpurple,
purple, dpurple, lorange, orange, pink, dpink, marine, cyan, lbrown,
dbrown.
IMAGES
You can place a logo in any corner of the graph using the "logo",
"logo_resize" and "logo_position" options. See GD::Graph. If you
just want a background image that is resized to fit your graph, see
the "background_image" option herein.
TEXT/CAPTIONS
The following GD::Graph options control placing text on the graph:
title, x_label and y_label. GD::Graph for those and related options.
In addition, this modules allows you to use the captionN option(s),
to draw arbitrary strings on the graph. See below.
IMPLEMENTATION
This module is implemented as a simple Apache mod_perl handler that
generates and returns a png format graph (using Martien Verbruggen's
image type can also be deduced from a single value in the
'Accept' header of the request.
jpeg_quality
Same as "PerlSetVar JpegQuality". A number from 0 to 100
that determines the jpeg quality and the size. If not set at
all, the GD library will determine the optimal setting.
Changing this value doesn't seem to do much as far as line
graphs go, but YMMV.
background_image
Set an image as the background for the graph. You are
responsible for choosing a sane image to go with your graph,
the background should be either transparent or the same
color you will use. This is the same as using the "logo"
parameter with an image of the same size as the graph,
except this option will resize the image if necessary,
making it more convenient for this purpose. The file or URL
can be of any type your copy of GD supports.
captionN
Draws a character string using a TrueType font at an
arbitrary location. Takes an array of
"($fgcolor,$fontname,$ptsize,$angle,$x,$y,$string[,$box_colo
lib/Apache/GD/Graph.pm view on Meta::CPAN
using the colour names from L<GD::Graph::colour>. They are, at time of writing:
white, lgray, gray, dgray, black, lblue, blue, dblue, gold, lyellow, yellow,
dyellow, lgreen, green, dgreen, lred, red, dred, lpurple, purple, dpurple,
lorange, orange, pink, dpink, marine, cyan, lbrown, dbrown.
=head1 IMAGES
You can place a logo in any corner of the graph using the C<logo>,
C<logo_resize> and C<logo_position> options. See L<GD::Graph>. If you just want
a background image that is resized to fit your graph, see the
C<background_image> option herein.
=head1 TEXT/CAPTIONS
The following GD::Graph options control placing text on the graph: title,
x_label and y_label. L<GD::Graph> for those and related options. In addition,
this modules allows you to use the captionN option(s), to draw arbitrary
strings on the graph. See below.
=head1 IMPLEMENTATION
lib/Apache/GD/Graph.pm view on Meta::CPAN
If not specified via this option or in the config file, the image type can also
be deduced from a single value in the 'Accept' header of the request.
=item B<jpeg_quality>
Same as C<PerlSetVar JpegQuality>. A number from 0 to 100 that determines the
jpeg quality and the size. If not set at all, the GD library will determine the
optimal setting. Changing this value doesn't seem to do much as far as line
graphs go, but YMMV.
=item B<background_image>
Set an image as the background for the graph. You are responsible for choosing
a sane image to go with your graph, the background should be either transparent
or the same color you will use. This is the same as using the C<logo> parameter
with an image of the same size as the graph, except this option will resize the
image if necessary, making it more convenient for this purpose. The file or URL
can be of any type your copy of GD supports.
=item B<captionN>
Draws a character string using a TrueType font at an arbitrary location. Takes
an array of
C<($fgcolor,$fontname,$ptsize,$angle,$x,$y,$string[,$box_color,$box_offset])>
lib/Apache/GD/Graph.pm view on Meta::CPAN
if ($type == TYPE_LIST) {
$value = [ $value, @rest ];
}
$args{$option} = $value;
}
arrayCheck $option, $value
if index (ARRAY_OPTIONS, $option) != -1;
};
# Check if background image specified.
if (exists $args{background_image}) {
my $image = new GD::Image($args{background_image});
die <<EOF if not defined $image;
Could not open your background image: $!
EOF
$graph->gd->copyResized(
$image, 0, 0,
0, 0, $width, $height,
$image->getBounds
);
delete $args{background_image};
}
# Check if we need to draw captions, draw them after graph is plotted.
my @captions;
$i = 1;
$key = "caption$i";
while (exists $args{$key}) {
die <<EOF unless UNIVERSAL::isa($args{$key}, 'ARRAY');
Caption must be an array. See the Apache::GD::Graph man page or the StringTTF
method in the GD man page for details.
( run in 3.370 seconds using v1.01-cache-2.11-cpan-fe3c2283af0 )