#!/usr/bin/perl -w use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard); use GD::Graph; print header(); print start_html( -title=>'Title' -BGCOLOR=>'#e5e6f4', -style=>{'src'=>'/myicons/styledefs.css','title'=>'rtpstd'}); print start_form, #snip form-related stuff, end_form; #snip database interrogation stuff my $graph=GD::Graph::bars->new(); my $format=$graph->export_format; #seems to default to GIF print header("image/$format"); binmode STDOUT; my @data = ( ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], [ 1, 2, 5, 6, 3, 1.5, 1, 3, 4] ); # I originally had @data pointing to some arrays generated from the above database interrogation, but I changed it to the above to eliminate this as a source of error. my $gd=$graph->plot(\@data)->$format() or die $graph->error; print $gd; print end_html;