tommycahir1
Programmer
how do you draw mulitple images on a web page using GD::graph
the following is the code for printing the graph so far.
sub print_graph#prints the graph to screen
{
my $q = new CGI;
my ($xarray,$values,$xlabel,$ylabel,$title,$IfNum) = @_;
my @data = ($xarray,$values);
$title = $title.$IfNum;
my $graph = new GD::Graph::lines(500,350);
$graph->set
(
x_label => $xlabel,
y_label => $ylabel,
title => $title,
x_label_skip => 'auto',
y_label_skip => 'auto',
line_width => 1,
y_tick_number => 8,
x_labels_vertical => 1,
x_label_position => 1/2,
transparent => 0,
);
my $gd_image = $graph->plot(\@data);
print header(-type => "image/png");
binmode STDOUT;
print $gd_image->png;
}
its called twice to print out the number of packets recieved on each interface in a workstation but it only ever prints out the first one. (the software loop back)
the following is the code for printing the graph so far.
sub print_graph#prints the graph to screen
{
my $q = new CGI;
my ($xarray,$values,$xlabel,$ylabel,$title,$IfNum) = @_;
my @data = ($xarray,$values);
$title = $title.$IfNum;
my $graph = new GD::Graph::lines(500,350);
$graph->set
(
x_label => $xlabel,
y_label => $ylabel,
title => $title,
x_label_skip => 'auto',
y_label_skip => 'auto',
line_width => 1,
y_tick_number => 8,
x_labels_vertical => 1,
x_label_position => 1/2,
transparent => 0,
);
my $gd_image = $graph->plot(\@data);
print header(-type => "image/png");
binmode STDOUT;
print $gd_image->png;
}
its called twice to print out the number of packets recieved on each interface in a workstation but it only ever prints out the first one. (the software loop back)