[LON-CAPA-cvs] cvs: loncom /xml lonplot.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 28 Aug 2007 23:48:39 -0000


albertel		Tue Aug 28 19:48:39 2007 EDT

  Modified files:              
    /loncom/xml	lonplot.pm 
  Log:
  - support gnuplot 4.2
  
  
Index: loncom/xml/lonplot.pm
diff -u loncom/xml/lonplot.pm:1.128 loncom/xml/lonplot.pm:1.129
--- loncom/xml/lonplot.pm:1.128	Thu Aug  9 02:25:43 2007
+++ loncom/xml/lonplot.pm	Tue Aug 28 19:48:39 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Dynamic plot
 #
-# $Id: lonplot.pm,v 1.128 2007/08/09 06:25:43 albertel Exp $
+# $Id: lonplot.pm,v 1.129 2007/08/28 23:48:39 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,11 +36,10 @@
 use Apache::lonxml;
 use Apache::edit;
 use Apache::lonnet;
-use lib '/home/httpd/lib/perl/';
 use LONCAPA;
  
 
-use vars qw/$weboutputformat $versionstring/;
+use vars qw/$weboutputformat $version/;
 
 
 
@@ -49,8 +48,9 @@
     #
     # Determine the version of GNUPLOT
     $weboutputformat = 'gif';
-    $versionstring = `gnuplot --version 2>/dev/null`;
-    if ($versionstring =~ /^gnuplot 4/) {
+    my $versionstring = `gnuplot --version 2>/dev/null`;
+    ($version) = ($versionstring =~ /^gnuplot ([\d.]+)/);
+    if ($version >= 4) {
         $weboutputformat = 'png';
     }
     
@@ -1259,9 +1259,15 @@
     if (lc($Apache::lonplot::plot{'bmargin'}) ne 'default') {
         $gnuplot_input .= 'set bmargin '.$Apache::lonplot::plot{'bmargin'}.$/;
     }
+
     # tic scales
-    $gnuplot_input .= 'set ticscale '.
-        $Apache::lonplot::plot{'major_ticscale'}.' '.$Apache::lonplot::plot{'minor_ticscale'}.$/;
+    if ($version > 4) {
+	$gnuplot_input .= 'set tics scale '.
+	    $Apache::lonplot::plot{'major_ticscale'}.', '.$Apache::lonplot::plot{'minor_ticscale'}.$/;
+    } else {
+    	$gnuplot_input .= 'set ticscale '.
+	    $Apache::lonplot::plot{'major_ticscale'}.' '.$Apache::lonplot::plot{'minor_ticscale'}.$/;
+    }
     #boxwidth
     if (lc($Apache::lonplot::plot{'boxwidth'}) ne '') {
 	$gnuplot_input .= 'set boxwidth '.$Apache::lonplot::plot{'boxwidth'}.$/;