<%init> use GD::Graph::bars; use Data::Dumper; my ($x, $y, @numbers, $number); my @data = ( # X axis [ qw( -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 )] ); # loop for each success level for ($x = 1; $x < 5; $x++){ # generate numbers for each skill level for ($y = 1; $y < 19; $y++){ $number = $x*$y*2+5; push @numbers, $number; } push @data, [@numbers]; @numbers = 0; } my $graph = new GD::Graph::bars(); $graph->set( title => 'Skill Resolution', x_label => 'Skill Level', y_label => 'Success Level' ); my $gd = $graph->plot(\@data) or die "Could not plot: ".$graph->error. Dumper(@data); my $img = $gd->png(); $m->clear_buffer; $r->content_type("image/png"); $r->send_http_header; binmode STDOUT; $m->out($img); $m->abort(OK); # make sure nothing else gets sent </%init>
Neil Watson
watson-wilson.ca
In reply to Re: GD::Graph without saving file
by neilwatson
in thread GD::Graph without saving file
by neilwatson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |