#!/usr/bin/perl use strict; use warnings; use GD::Graph::bars; print "Content-type: text/html\n\n"; print "This is a test html page
\n"; print "
\n"; sub draw { my @dates = ( "2000", "2001", "2002", "2003", "2004" ); my @articles = ( 2, 1, 4, 7, 6 ); my @data; @data = ([ @dates ], [ @articles ]); my $graph; $graph = GD::Graph::bars->new(400,200); $graph->set( y_label => "Articles", x_label => "Date", bar_spacing => 3, show_values => 1 ) or die $graph->error; my $gd; $gd = $graph->plot(\@data) or die $graph->error; return "Content-type: image/png\n\n", $gd->png; } # end-sub exit;