--- loncom/interface/statistics/lonproblemstatistics.pm 2004/03/26 22:04:22 1.73
+++ loncom/interface/statistics/lonproblemstatistics.pm 2004/03/29 15:58:33 1.74
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonproblemstatistics.pm,v 1.73 2004/03/26 22:04:22 matthew Exp $
+# $Id: lonproblemstatistics.pm,v 1.74 2004/03/29 15:58:33 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -480,6 +480,8 @@ sub make_plot {
&sort_data($ENV{'form.sortby'});
if ($plot eq 'degrees') {
°rees_plot($r);
+ } elsif ($plot eq 'tries statistics') {
+ &tries_data_plot($r);
} else {
&make_single_stat_plot($r,$plot);
}
@@ -636,6 +638,85 @@ END
return;
}
+sub tries_data_plot {
+ my ($r)=@_;
+ my $count = scalar(@StatsArray);
+ my $width = 50 + 10*$count;
+ $width = 300 if ($width < 300);
+ my $height = 300;
+ my $plot = '';
+ my @STD; my @Mean; my @Max; my @Min;
+ my @Labels;
+ my $ymax = 5;
+ foreach my $data (@StatsArray) {
+ my $max = $data->{'mean_tries'} + $data->{'std_tries'};
+ $ymax = $max if ($ymax < $max);
+ $ymax = $max if ($ymax < $max);
+ push(@Labels,$data->{'problem_num'});
+ push(@STD,$data->{'std_tries'});
+ push(@Mean,$data->{'mean_tries'});
+ }
+ #
+ # Make sure we show relevant information.
+ my $xmax = $Labels[-1];
+ if ($xmax > 50) {
+ if ($xmax % 10 != 0) {
+ $xmax = 10 * (int($xmax/10)+1);
+ }
+ } else {
+ if ($xmax % 5 != 0) {
+ $xmax = 5 * (int($xmax/5)+1);
+ }
+ }
+ $ymax = int($ymax)+1+2;
+ #
+ my $std_data .= ''.join(',',@Labels).''.$/.
+ ''.join(',',@Mean).''.$/;
+ #
+ my $std_error_data .= ''.join(',',@Labels).''.$/.
+ ''.join(',',@Mean).''.$/.
+ ''.join(',',@STD).''.$/;
+ #
+ $plot=<<"END";
+
'.&Apache::lonxml::xmlparse($r,'web',$plot).'
'.$/; + $r->print($plotresult); + return; +} + sub plot_dropdown { my $current = ''; # @@ -646,7 +727,10 @@ sub plot_dropdown { my @Additional_Plots = ( { graphable=>'yes', name => 'degrees', - title => 'DoDisc and DoDiff' }); + title => 'DoDisc and DoDiff' }, + { graphable=>'yes', + name => 'tries statistics', + title => 'Mean and S.D. of Tries' }); # my $Str= "\n".'