On 31 Mar 2003 02:38:43 -0700, [EMAIL PROTECTED] (Jdavis) wrote:

>Hello,
>
>I would like to make a bar graph, in a png or jpg format. Could
>someone suggest a good perl moduel to help me.

And here is a simple example, which includes a bonus logo.

#!/usr/bin/perl -w
use warnings;
use GD::Graph::bars;

@data = (
    ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"],
    [    1,    2,    5,    6,    3,  1.5,    1,     3,     4],
    [ sort { $a <=> $b } (1, 2, 5, 6, 3, 1.5, 1, 3, 4) ]
);

$graph = GD::Graph::bars->new(400, 300);

$graph->set(
    transparent       => '0',
    bgclr             => 'lgray',
    boxclr            => 'white',
    fgclr             => 'white',
    x_label           => 'X Label',
    y_label           => 'Y label',
    title             => 'Some simple graph',
    y_max_value       => 8,
    y_tick_number     => 8,
    y_label_skip      => 2,
    logo              => 'zicon.png',
    logo_resize       => '.5',
    logo_position     => 'UL'
);

my $gd_image = $graph->plot([EMAIL PROTECTED]);
open(OUTPUT, ">$0.png") or die "Can't open 
                                                       $0.png: $!\n";
print OUTPUT $gd_image->png();
close(OUTPUT);



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to