[LON-CAPA-cvs] cvs: loncom /interface/statistics lonsubmissiontimeanalysis.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 08 Jan 2004 19:18:50 -0000


matthew		Thu Jan  8 14:18:50 2004 EDT

  Modified files:              
    /loncom/interface/statistics	lonsubmissiontimeanalysis.pm 
  Log:
  Fix graph width.  GD::Graph divides by zero when you give it a legend that
  is wider than the graph itself.
  
  
Index: loncom/interface/statistics/lonsubmissiontimeanalysis.pm
diff -u loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.7 loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.8
--- loncom/interface/statistics/lonsubmissiontimeanalysis.pm:1.7	Thu Jan  8 10:51:16 2004
+++ loncom/interface/statistics/lonsubmissiontimeanalysis.pm	Thu Jan  8 14:18:50 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonsubmissiontimeanalysis.pm,v 1.7 2004/01/08 15:51:16 matthew Exp $
+# $Id: lonsubmissiontimeanalysis.pm,v 1.8 2004/01/08 19:18:50 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -253,6 +253,10 @@
     (undef,undef,undef,$mday,$month,$year,$wday) = localtime($endtime);
     $xlabel .= $FullWeekDay[$wday].' '.
         join(' ',($Month[$month],$mday,1900+$year));
+    my $width = 50+2*$bincount;
+    if ($width < 250) {
+        $width = 250;
+    }
     $html .= &Apache::loncommon::DrawXYYGraph($title,
                                               $xlabel,
                                               'Submissions vs Time',
@@ -265,7 +269,7 @@
                                               (xskip => $bins_per_day,
                                                x_ticks => $bins_per_day,
                                                x_tick_offset => $bins_per_day,
-                                               width => 50+2*$bincount,
+                                               width => $width,
                       y1_label=>'Number of Submissions per hour',
                       y2_label=>'Percent of Students answering Correctly',
                      'data.1.label'=>'Submissions per hour',