version 1.73, 2004/03/26 22:04:22
|
version 1.74, 2004/03/29 15:58:33
|
Line 480 sub make_plot {
|
Line 480 sub make_plot {
|
&sort_data($ENV{'form.sortby'}); |
&sort_data($ENV{'form.sortby'}); |
if ($plot eq 'degrees') { |
if ($plot eq 'degrees') { |
°rees_plot($r); |
°rees_plot($r); |
|
} elsif ($plot eq 'tries statistics') { |
|
&tries_data_plot($r); |
} else { |
} else { |
&make_single_stat_plot($r,$plot); |
&make_single_stat_plot($r,$plot); |
} |
} |
Line 636 END
|
Line 638 END
|
return; |
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 .= '<data>'.join(',',@Labels).'</data>'.$/. |
|
'<data>'.join(',',@Mean).'</data>'.$/; |
|
# |
|
my $std_error_data .= '<data>'.join(',',@Labels).'</data>'.$/. |
|
'<data>'.join(',',@Mean).'</data>'.$/. |
|
'<data>'.join(',',@STD).'</data>'.$/; |
|
# |
|
$plot=<<"END"; |
|
<gnuplot |
|
texfont="10" |
|
fgcolor="x000000" |
|
plottype="Cartesian" |
|
font="large" |
|
grid="on" |
|
align="center" |
|
border="on" |
|
transparent="on" |
|
alttag="Sample Plot" |
|
samples="100" |
|
bgcolor="xffffff" |
|
height="$height" |
|
width="$width"> |
|
<title>Mean and S.D. of Tries</title> |
|
<axis xmin="0" ymin="0" xmax="$xmax" ymax="$ymax" color="x000000" /> |
|
<xlabel>Problem Number</xlabel> |
|
<curve |
|
linestyle="yerrorbars" |
|
name="S.D. Tries" |
|
pointtype="1" |
|
color="x666666"> |
|
$std_error_data |
|
</curve> |
|
<curve |
|
linestyle="points" |
|
name="Mean Tries" |
|
pointtype="1" |
|
color="xCC4444"> |
|
$std_data |
|
</curve> |
|
</gnuplot> |
|
END |
|
my $plotresult = |
|
'<p>'.&Apache::lonxml::xmlparse($r,'web',$plot).'</p>'.$/; |
|
$r->print($plotresult); |
|
return; |
|
} |
|
|
sub plot_dropdown { |
sub plot_dropdown { |
my $current = ''; |
my $current = ''; |
# |
# |
Line 646 sub plot_dropdown {
|
Line 727 sub plot_dropdown {
|
my @Additional_Plots = ( |
my @Additional_Plots = ( |
{ graphable=>'yes', |
{ graphable=>'yes', |
name => 'degrees', |
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".'<select name="plot" size="1">'; |
my $Str= "\n".'<select name="plot" size="1">'; |
$Str .= '<option name="none"></option>'."\n"; |
$Str .= '<option name="none"></option>'."\n"; |