--- loncom/cgi/graph.png 2003/10/09 22:04:37 1.24
+++ loncom/cgi/graph.png 2003/10/21 15:19:25 1.28
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# $Id: graph.png,v 1.24 2003/10/09 22:04:37 matthew Exp $
+# $Id: graph.png,v 1.28 2003/10/21 15:19:25 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -74,27 +74,22 @@ Content-type: text/html
Bad Cookie
-Your cookie information is incorrect. What\'s up with that?
+Your cookie information is incorrect.
END
- return;
+ exit;
}
$|=1; # Autoflush after each print/write
my $identifier = $ENV{'QUERY_STRING'};
-my $Title = &unescape($ENV{$identifier.'.title'});
-my $xlabel = &unescape($ENV{$identifier.'.xlabel'});
-my $ylabel = &unescape($ENV{$identifier.'.ylabel'});
-my $Max = $ENV{$identifier.'.Max'};
-my $NumBars = $ENV{$identifier.'.NumBars'};
-my $data1 = $ENV{$identifier.'.data1'};
-my $data2 = $ENV{$identifier.'.data2'};
-
-my @data11=split(/\,/,$data1);
-my @data12=split(/\,/,$data2);
-my $skip_x = 1;
-my $bar_width=10;
+my $Title = &unescape($ENV{'cgi.'.$identifier.'.title'});
+my $xlabel = &unescape($ENV{'cgi.'.$identifier.'.xlabel'});
+my $ylabel = &unescape($ENV{'cgi.'.$identifier.'.ylabel'});
+my $Max = $ENV{'cgi.'.$identifier.'.Max'};
+my $NumBars = $ENV{'cgi.'.$identifier.'.NumBars'};
+my $NumSets = $ENV{'cgi.'.$identifier.'.NumSets'};
+my @Colors = split(',',$ENV{'cgi.'.$identifier.'.Colors'});
#
# Labels are always digits
@@ -102,8 +97,14 @@ my @xlabels;
for (my $nIdx=0; $nIdx<$NumBars; $nIdx++ ) {
$xlabels[$nIdx]=$nIdx+1;
}
+my @data; # stores the data for the graph
+push(@data,\@xlabels);
+for (my $i=1;$i<=$NumSets;$i++) {
+ push(@data,[split(',',$ENV{'cgi.'.$identifier.'.data.'.$i})]);
+}
-my @data =(\@xlabels,\@data11,\@data12);
+my $skip_x = 1;
+my $bar_width=10;
#
# Customize graph based on the
@@ -146,8 +147,7 @@ if (! $MyGraph->set( x_label =>
x_label_skip => $skip_x,
x_tick_offset => $x_tick_offset,
#
- dclrs => [ qw(lgreen dgreen lyellow
- lpurple cyan lorange)],
+ dclrs => \@Colors,
bar_width => $bar_width,
cumulate => 2,
zero_axis => 1,