[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /interface/statistics lonproblemanalysis.pm lonproblemstatistics.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Mon, 02 Feb 2004 19:32:11 -0000
matthew Mon Feb 2 14:32:11 2004 EDT
Modified files:
/loncom/interface loncommon.pm
/loncom/interface/statistics lonproblemanalysis.pm
lonproblemstatistics.pm
Log:
Added \@Labels to DrawBarGraph inputs (labels on the x-axis).
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.177 loncom/interface/loncommon.pm:1.178
--- loncom/interface/loncommon.pm:1.177 Thu Jan 29 14:29:53 2004
+++ loncom/interface/loncommon.pm Mon Feb 2 14:32:11 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.177 2004/01/29 19:29:53 www Exp $
+# $Id: loncommon.pm,v 1.178 2004/02/02 19:32:11 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2992,6 +2992,8 @@
=item $colors: array ref holding the colors to be used for the data sets when
they are plotted. If undefined, default values will be used.
+=item $labels: array ref holding the labels to use on the x-axis for the bars.
+
=item @Values: An array of array references. Each array reference holds data
to be plotted in a stacked bar chart.
@@ -3007,7 +3009,7 @@
############################################################
############################################################
sub DrawBarGraph {
- my ($Title,$xlabel,$ylabel,$Max,$colors,@Values)=@_;
+ my ($Title,$xlabel,$ylabel,$Max,$colors,$labels,@Values)=@_;
#
if (! defined($colors)) {
$colors = ['#33ff00',
@@ -3050,8 +3052,12 @@
}
#
my @Labels;
- for (my $i=0;$i<@{$Values[0]};$i++) {
- push (@Labels,$i+1);
+ if (defined($labels)) {
+ @Labels = @$labels;
+ } else {
+ for (my $i=0;$i<@{$Values[0]};$i++) {
+ push (@Labels,$i+1);
+ }
}
#
$Max = 1 if ($Max < 1);
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.63 loncom/interface/statistics/lonproblemanalysis.pm:1.64
--- loncom/interface/statistics/lonproblemanalysis.pm:1.63 Fri Jan 30 11:31:36 2004
+++ loncom/interface/statistics/lonproblemanalysis.pm Mon Feb 2 14:32:11 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonproblemanalysis.pm,v 1.63 2004/01/30 16:31:36 matthew Exp $
+# $Id: lonproblemanalysis.pm,v 1.64 2004/02/02 19:32:11 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -301,6 +301,7 @@
'Percent Choosing',
100,
['#33ff00','#ff3300'],
+ undef,
\@PlotData_Correct,
\@PlotData_Incorrect);
}
@@ -493,7 +494,7 @@
}
my $correctgraph = &Apache::loncommon::DrawBarGraph
($title,'Foil Number','Percent Correct',
- 100,$plotcolors,$Datasets[0]);
+ 100,$plotcolors,undef,$Datasets[0]);
$analysis_html.= '<tr><td>'.$correctgraph.'</td>';
##
##
@@ -512,7 +513,7 @@
$title = 'Attempt '.$i.', '.$count;
my $incorrectgraph = &Apache::loncommon::DrawBarGraph
($title,'Foil Number','% Option Chosen Incorrectly',
- 100,$plotcolors,@Datasets);
+ 100,$plotcolors,undef,@Datasets);
$analysis_html.= '<td>'.$incorrectgraph.'</td>';
$analysis_html.= '<td>'.$foilkey."<td></tr>\n";
}
@@ -579,7 +580,7 @@
$title = 'Attempt '.$i.', '.$count;
my $graphlink = &Apache::loncommon::DrawBarGraph
($title,'Concept Number','Percent Correct',
- 100,$plotcolors,$PlotData[$i]->{'_correct'});
+ 100,$plotcolors,undef,$PlotData[$i]->{'_correct'});
$analysis_html.= '<tr><td>'.$graphlink."</td></tr>\n";
}
$analysis_html .= "</table>\n";
@@ -744,6 +745,7 @@
'Percent Correct',
100,
$plotcolors,
+ undef,
$Plotdata[0]);
for (my $j=0; $j< scalar(@{$Plotdata[0]});$j++) {
$Plotdata[0]->[$j]=0;
@@ -761,6 +763,7 @@
'Incorrect Option Choice',
100,
$plotcolors,
+ undef,
@Plotdata);
$analysis_html.='<tr>'.
'<td>'.$correctplot.'</td>'.
@@ -825,6 +828,7 @@
'Percent Correct',
100,
$plotcolors,
+ undef,
\@Plotdata);
$analysis_html.='<tr>'.
'<td>'.$correctplot.'</td>'.
Index: loncom/interface/statistics/lonproblemstatistics.pm
diff -u loncom/interface/statistics/lonproblemstatistics.pm:1.64 loncom/interface/statistics/lonproblemstatistics.pm:1.65
--- loncom/interface/statistics/lonproblemstatistics.pm:1.64 Wed Jan 28 09:38:40 2004
+++ loncom/interface/statistics/lonproblemstatistics.pm Mon Feb 2 14:32:11 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonproblemstatistics.pm,v 1.64 2004/01/28 14:38:40 matthew Exp $
+# $Id: lonproblemstatistics.pm,v 1.65 2004/02/02 19:32:11 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -773,7 +773,8 @@
'Problem Number',
$yaxis,
$Max,
- undef,
+ undef, # colors
+ undef, # labels
\@Data)."</p>\n");
#
# Print out the data