--- loncom/interface/statistics/lonproblemstatistics.pm 2002/08/13 13:57:25 1.21 +++ loncom/interface/statistics/lonproblemstatistics.pm 2002/08/13 15:01:07 1.22 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonproblemstatistics.pm,v 1.21 2002/08/13 13:57:25 stredwic Exp $ +# $Id: lonproblemstatistics.pm,v 1.22 2002/08/13 15:01:07 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -627,49 +627,46 @@ sub Discriminant { # ------------------------------------------- Prepare data for Graphical chart sub BuildGraphicChart { - my ($ylab,$r,$cacheDB)=@_; + my ($graph,$cacheDB,$courseDescription,$r)=@_; my %cache; - my $Col; - my $data=''; - my $count = 0; - my $Max = 0; + my $max = 0; unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { return '
Unable to tie database.'; } - my $p_count = $cache{'ProblemCount'}; - - for ( my $k=0; $k<$p_count;$k++) { - my @Temp=split(/\:/,$cache{'GraphGif:'.$k}); - my $inf = $Temp[$Col]; - if ( $Max < $inf ) {$Max = $inf;} - $data .= $inf.','; - $count++; + my @problems = split(':::', $cache{'problemList'}); + my @values = (); + foreach (@problems) { + my $data = 0; + if($graph eq 'DoDiffGraph') { + $data = sprintf("%.2f", $cache{$_.':degreeOfDifficulty'}), + } else { + $data = sprintf("%.1f", $cache{$_.':percentWrong'}), + } + if($max < $data) { + $max = $data; + } + push(@values, $data); } untie(%cache); -# $r->print("