--- loncom/interface/statistics/lonpercentage.pm 2002/08/30 15:35:08 1.1
+++ loncom/interface/statistics/lonpercentage.pm 2003/01/11 06:31:26 1.5
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonpercentage.pm,v 1.1 2002/08/30 15:35:08 stredwic Exp $
+# $Id: lonpercentage.pm,v 1.5 2003/01/11 06:31:26 minaeibi Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -34,7 +34,6 @@ use Apache::lonhtmlcommon;
use Apache::loncoursedata;
use GDBM_File;
-#my $jr;
sub BuildPercentageGraph {
my ($cacheDB, $students, $courseID, $c, $r)=@_;
@@ -60,8 +59,8 @@ sub BuildPercentageGraph {
return;
}
- my ($Ptr, $percentage) = &GraphData(\%cache, $students);
- $r->print($Ptr.'
');
+ my ($Ptr, $percentage) = &GraphData(\%cache, $students,$r);
+ $r->print($Ptr.'
');
$r->print(&TableData(\%cache, $percentage));
@@ -186,7 +185,7 @@ sub InitializeSelectedStudents {
}
sub GraphData {
- my ($cache,$students)=@_;
+ my ($cache,$students,$r)=@_;
my $sequenceSelected = $cache->{'StatisticsMaps'};
my $problemSelected = $cache->{'StatisticsProblemSelect'};
@@ -235,40 +234,74 @@ sub GraphData {
my @percent = ();
my @percentCount = ();
my $max = 0;
- foreach my $key (sort(keys(%percentages))) {
+ my $pno = 0;
+ foreach my $key (sort NumericSort keys(%percentages)) {
push(@percent, $key);
- my $count = scalar(split(':::', $percentages{$key}));
+ my @temp = split(':::', $percentages{$key});
+ my $count = scalar(@temp);
if($count > $max) {
$max = $count;
}
push(@percentCount, $count);
+ $pno++;
}
- my @GData = ('', 'Percentage', 'Number_of_Students',
- $max, scalar(@percent),
- join(',',@percent), join(',', @percentCount));
+# $r->print('
max='.$max);
+# $r->print('
percentcount='.join(',', @percentCount));
+# $r->print('
percent='.join(',', @percent));
+
+ my $cId=0;
+ my @data1=();
+ my @data2=();
+ for (my $nIdx=0; $nIdx<$pno; $nIdx++ ) {
+ $data1[$cId]=$percent[$nIdx];
+ $data2[$cId]=$percentCount[$nIdx];
+ my $cr=$percent[$nIdx+1];
+ while ($data1[$cId]<$cr) {
+ $cId++;
+ $data1[$cId]=$cId;
+ $data2[$cId]=0;
+ }
+ }
+
+# $r->print('
percentcount='.join(',', @data1));
+# $r->print('
percent='.join(',', @data2));
+
+
+ my @GData = ('','Percentage','Number_of_Students',$max,101 ,
+ join(',',@data1), join(',', @data2));
$Ptr .= ''."\n";
- $Ptr .= ' $b;
+}
+
sub TableData {
my($cache,$percentage)=@_;
my $Ptr;
- $Ptr .= '