[LON-CAPA-cvs] cvs: loncom /cgi graph.png

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 29 Oct 2003 14:47:43 -0000


matthew		Wed Oct 29 09:47:43 2003 EDT

  Modified files:              
    /loncom/cgi	graph.png 
  Log:
  Added support for two axes graph and commented out some debugging code.
  
  
Index: loncom/cgi/graph.png
diff -u loncom/cgi/graph.png:1.29 loncom/cgi/graph.png:1.30
--- loncom/cgi/graph.png:1.29	Mon Oct 27 16:21:08 2003
+++ loncom/cgi/graph.png	Wed Oct 29 09:47:43 2003
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# $Id: graph.png,v 1.29 2003/10/27 21:21:08 matthew Exp $
+# $Id: graph.png,v 1.30 2003/10/29 14:47:43 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -143,7 +143,7 @@
 
 $GraphSettings{'x_label_skip'}  = &get_env('xskip',1);
 $GraphSettings{'x_tick_offset'} = &get_env('x_tick_offset',0);
-$GraphSettings{'y_max_value'}   = &get_env('Max',undef);
+$GraphSettings{'y_max_value'}   = &get_env('Max',1);
 
 my $MyGraph;
 if ($PlotType eq 'bar') {
@@ -168,6 +168,13 @@
     $GraphSettings{'x_label_skip'}  = $skip_x;
     $GraphSettings{'x_tick_offset'} = $x_tick_offset;
     $GraphSettings{'zero_axis'}     = 1;
+    if (&get_env('two_axes',0)) {
+        $GraphSettings{'two_axes'}     = 1;
+        $GraphSettings{'y1_max_value'} = &get_env('y1_max_value',0);
+        $GraphSettings{'y1_min_value'} = &get_env('y1_min_value',1);
+        $GraphSettings{'y2_max_value'} = &get_env('y2_max_value',1);
+        $GraphSettings{'y2_min_value'} = &get_env('y2_min_value',1);
+    }
 }
 #
 # Pick up miscellanious values passed in by the user
@@ -202,9 +209,11 @@
 my $plot = $MyGraph->plot(\@Data);
 if (! defined($plot)) {
     my $error = 'Unable to plot the data provided.';
-    $error .= '<pre>'.join(',',@{$Data[0]}).'</pre>';
-    $error .= '<pre>'.join(',',@{$Data[1]}).'</pre>';
-    $error .= '<pre>'.join(',',@{$Data[2]}).'</pre>';
+# Debugging code:    
+#    $error .= '<pre>'.join(',',@{$Data[0]}).'</pre>';
+#    $error .= '<pre>'.join(',',@{$Data[1]}).'</pre>';
+#    $error .= '<pre>'.join(',',@{$Data[2]}).'</pre>' if (ref($Data[2]));
+#    $error .= '<pre>'.join(',',@{$Data[3]}).'</pre>' if (ref($Data[3]));
     print &error($error);
     exit;
 }