--- loncom/cgi/graph.png 2003/10/09 22:04:37 1.24 +++ loncom/cgi/graph.png 2003/10/15 21:08:39 1.25 @@ -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.25 2003/10/15 21:08:39 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -88,13 +88,8 @@ my $xlabel = &unescape($ENV{$identifier 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 $NumSets = $ENV{$identifier.'.NumSets'}; +my @Colors = split(',',$ENV{$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{$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,