Diff for /loncom/xml/lonplot.pm between versions 1.118.2.3 and 1.119

version 1.118.2.3, 2007/10/09 22:26:54 version 1.119, 2007/06/19 01:15:24
Line 117  my $pos_real_test  = Line 117  my $pos_real_test  =
 my $color_test     = sub {$_[0]=~s/\s+//g;$_[0]=~/^x[\da-fA-F]{6}$/};  my $color_test     = sub {$_[0]=~s/\s+//g;$_[0]=~/^x[\da-fA-F]{6}$/};
 my $onoff_test     = sub {$_[0]=~/^(on|off)$/};  my $onoff_test     = sub {$_[0]=~/^(on|off)$/};
 my $key_pos_test   = sub {$_[0]=~/^(top|bottom|right|left|outside|below| )+$/};  my $key_pos_test   = sub {$_[0]=~/^(top|bottom|right|left|outside|below| )+$/};
 my $sml_test       = sub {$_[0]=~/^(small|medium|large)$/};  my $sml_test       = sub {$_[0]=~/^(\d+|small|medium|large)$/};
 my $linestyle_test = sub {exists($linestyles{$_[0]})};  my $linestyle_test = sub {exists($linestyles{$_[0]})};
 my $words_test     = sub {$_[0]=~s/\s+/ /g;$_[0]=~/^([\w~!\@\#\$\%^&\*\(\)-=_\+\[\]\{\}:\;\'<>,\.\/\?\\]+ ?)+$/};  my $words_test     = sub {$_[0]=~s/\s+/ /g;$_[0]=~/^([\w~!\@\#\$\%^&\*\(\)-=_\+\[\]\{\}:\;\'<>,\.\/\?\\]+ ?)+$/};
   
Line 203  my %gnuplot_defaults = Line 203  my %gnuplot_defaults =
  edit_type   => 'onoff'   edit_type   => 'onoff'
  },   },
      font         => {       font         => {
  default     => 'medium',   default     => '9',
  test        => $sml_test,   test        => $sml_test,
  description => 'Size of font to use',   description => 'Size of font to use',
  edit_type   => 'choice',   edit_type   => 'choice',
  choices     => ['small','medium','large']   choices     => [['5','5 (small)'],'7',['9','9 (medium)'],'10','12',['15','15 (large)']]
  },   },
      samples      => {       samples      => {
  default     => '100',   default     => '100',
Line 493  my %curve_defaults = Line 493  my %curve_defaults =
  choices     => [keys(%linestyles)]   choices     => [keys(%linestyles)]
  },   },
      linewidth => {       linewidth => {
          default     => 1,           default     => 4,
          test        => $int_test,           test        => $int_test,
          description => 'Line width (may not apply to all line styles)',           description => 'Line width (may not apply to all line styles)',
          edit_type   => 'choice',           edit_type   => 'choice',
Line 673  sub end_ytics { Line 673  sub end_ytics {
     return $result;      return $result;
 }  }
   
   ##-----------------------------------------------------------------font
   sub get_font {
       my ($size);
       if ( $Apache::lonplot::plot{'font'} =~ /^(small|medium|large)/) {
    if ( $Apache::lonplot::plot{'font'} eq 'small') {
       $size = '5';
    } elsif ( $Apache::lonplot::plot{'font'} eq 'medium') {
       $size = '9';
    } elsif ( $Apache::lonplot::plot{'font'} eq 'large') {
       $size = '15';
    } else {
       $size = '9';
    }
       } else {
    $size = $Apache::lonplot::plot{'font'};
       }
       return ($size);
   }
   
 ##----------------------------------------------------------------- key  ##----------------------------------------------------------------- key
 sub start_key {  sub start_key {
Line 1101  sub write_gnuplot_file { Line 1119  sub write_gnuplot_file {
     }      }
     # set term      # set term
     if ($target eq 'web') {      if ($target eq 'web') {
  $gnuplot_input .= 'set term '.$weboutputformat .' ';   $gnuplot_input .= 'set term '.$weboutputformat .' enhanced ';
  $gnuplot_input .= 'transparent ' if ($Apache::lonplot::plot{'transparent'} eq 'on');   $gnuplot_input .= 'transparent ' if ($Apache::lonplot::plot{'transparent'} eq 'on');
  $gnuplot_input .= $Apache::lonplot::plot{'font'} . ' ';   $gnuplot_input .= $Apache::lonplot::plot{'font'} . ' ';
  $gnuplot_input .= 'size '.$Apache::lonplot::plot{'width'}.','.$Apache::lonplot::plot{'height'}.' ';   $gnuplot_input .= 'size '.$Apache::lonplot::plot{'width'}.','.$Apache::lonplot::plot{'height'}.' ';
Line 1109  sub write_gnuplot_file { Line 1127  sub write_gnuplot_file {
  # set output   # set output
  $gnuplot_input .= "set output\n";   $gnuplot_input .= "set output\n";
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  $gnuplot_input .= "set term postscript eps $Apache::lonplot::plot{'plotcolor'} solid \"Helvetica\" $pt \n";   $gnuplot_input .= "set term postscript eps enhanced $Apache::lonplot::plot{'plotcolor'} solid \"Helvetica\" $pt \n";
  $gnuplot_input .= "set output \"/home/httpd/perl/tmp/".   $gnuplot_input .= "set output \"/home/httpd/perl/tmp/".
     &unescape($filename).".eps\"\n";      &unescape($filename).".eps\"\n";
     }      }
Line 1246  sub write_gnuplot_file { Line 1264  sub write_gnuplot_file {
  $curve->{'function'}.' title "'.   $curve->{'function'}.' title "'.
  $curve->{'name'}.'" with '.   $curve->{'name'}.'" with '.
                 $curve->{'linestyle'};                  $curve->{'linestyle'};
               $gnuplot_input.= ' linewidth '.$curve->{'linewidth'};
   
             if (($curve->{'linestyle'} eq 'points')      ||              if (($curve->{'linestyle'} eq 'points')      ||
                 ($curve->{'linestyle'} eq 'linespoints') ||                  ($curve->{'linestyle'} eq 'linespoints') ||
Line 1258  sub write_gnuplot_file { Line 1277  sub write_gnuplot_file {
             } elsif ($curve->{'linestyle'} eq 'filledcurves') {               } elsif ($curve->{'linestyle'} eq 'filledcurves') { 
                 $gnuplot_input.= ' '.$curve->{'limit'};                  $gnuplot_input.= ' '.$curve->{'limit'};
             }              }
             $gnuplot_input.= ' linewidth '.$curve->{'linewidth'};  
   
  } elsif (exists($curve->{'data'})) {   } elsif (exists($curve->{'data'})) {
     # Store data values in $datatext      # Store data values in $datatext
     my $datatext = '';      my $datatext = '';
Line 1278  sub write_gnuplot_file { Line 1295  sub write_gnuplot_file {
     }      }
     #   write file      #   write file
     print $fh $datatext;      print $fh $datatext;
     close ($fh);      close($fh);
     #   generate gnuplot text      #   generate gnuplot text
     $gnuplot_input.= '"'.$datafilename.'" title "'.      $gnuplot_input.= '"'.$datafilename.'" title "'.
  $curve->{'name'}.'" with '.   $curve->{'name'}.'" with '.
  $curve->{'linestyle'};   $curve->{'linestyle'};
               $gnuplot_input.= ' linewidth '.$curve->{'linewidth'};
             if (($curve->{'linestyle'} eq 'points')      ||              if (($curve->{'linestyle'} eq 'points')      ||
                 ($curve->{'linestyle'} eq 'linespoints') ||                  ($curve->{'linestyle'} eq 'linespoints') ||
                 ($curve->{'linestyle'} eq 'errorbars')   ||                  ($curve->{'linestyle'} eq 'errorbars')   ||
Line 1294  sub write_gnuplot_file { Line 1312  sub write_gnuplot_file {
             } elsif ($curve->{'linestyle'} eq 'filledcurves') {               } elsif ($curve->{'linestyle'} eq 'filledcurves') { 
                 $gnuplot_input.= ' '.$curve->{'limit'};                  $gnuplot_input.= ' '.$curve->{'limit'};
             }              }
             $gnuplot_input.= ' linewidth '.$curve->{'linewidth'};  
  }   }
     }      }
     # Write the output to a file.      # Write the output to a file.

Removed from v.1.118.2.3  
changed lines
  Added in v.1.119


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>