version 1.91, 2003/09/27 04:08:56
|
version 1.92, 2003/10/24 17:35:32
|
Line 115 my $words_test = sub {$_[0]=~s/\s+/
|
Line 115 my $words_test = sub {$_[0]=~s/\s+/
|
################################################################### |
################################################################### |
my @gnuplot_edit_order = |
my @gnuplot_edit_order = |
qw/alttag bgcolor fgcolor height width font transparent grid samples |
qw/alttag bgcolor fgcolor height width font transparent grid samples |
border align texwidth plottype/; |
border align texwidth texfont plottype/; |
|
|
my $gnuplot_help_text = <<"ENDPLOTHELP"; |
my $gnuplot_help_text = <<"ENDPLOTHELP"; |
<p> |
<p> |
Line 232 my %gnuplot_defaults =
|
Line 232 my %gnuplot_defaults =
|
edit_type => 'entry', |
edit_type => 'entry', |
size => '5' |
size => '5' |
}, |
}, |
|
texfont => { |
|
default => '22', |
|
test => $int_test, |
|
description => 'Font size to use in TeX output (pts):', |
|
edit_type => 'choice', |
|
choices => [qw/10 12 14 16 18 20 22 24 26 28 30 32 34 36/], |
|
}, |
plottype => { |
plottype => { |
default => 'Cartesian', |
default => 'Cartesian', |
test => sub {$_[0]=~/^(Polar|Cartesian)$/}, |
test => sub {$_[0]=~/^(Polar|Cartesian)$/}, |
Line 987 sub set_defaults {
|
Line 994 sub set_defaults {
|
sub get_attributes{ |
sub get_attributes{ |
my ($values,$defaults,$parstack,$safeeval,$tag) = @_; |
my ($values,$defaults,$parstack,$safeeval,$tag) = @_; |
foreach my $attr (keys(%{$defaults})) { |
foreach my $attr (keys(%{$defaults})) { |
if ($attr eq 'texwidth') { |
if ($attr eq 'texwidth' || $attr eq 'texfont') { |
$values->{$attr} = |
$values->{$attr} = |
&Apache::lonxml::get_param($attr,$parstack,$safeeval,undef,1); |
&Apache::lonxml::get_param($attr,$parstack,$safeeval,undef,1); |
} else { |
} else { |
Line 1014 sub write_gnuplot_file {
|
Line 1021 sub write_gnuplot_file {
|
my ($tmpdir,$filename,$target)= @_; |
my ($tmpdir,$filename,$target)= @_; |
my $gnuplot_input = ''; |
my $gnuplot_input = ''; |
my $curve; |
my $curve; |
|
my $pt = $plot{'texfont'}; |
# Collect all the colors |
# Collect all the colors |
my @Colors; |
my @Colors; |
push @Colors, $plot{'bgcolor'}; |
push @Colors, $plot{'bgcolor'}; |
Line 1034 sub write_gnuplot_file {
|
Line 1042 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 monochrome solid \"Helvetica\" 25 \n"; |
$gnuplot_input .= "set term postscript eps monochrome solid \"Helvetica\" $pt \n"; |
$gnuplot_input .= "set output \"/home/httpd/perl/tmp/". |
$gnuplot_input .= "set output \"/home/httpd/perl/tmp/". |
&Apache::lonnet::unescape($filename).".eps\"\n"; |
&Apache::lonnet::unescape($filename).".eps\"\n"; |
} |
} |
Line 1055 sub write_gnuplot_file {
|
Line 1063 sub write_gnuplot_file {
|
# title, xlabel, ylabel |
# title, xlabel, ylabel |
# titles |
# titles |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$gnuplot_input .= "set title \"$title\" font \"Helvetica,25pt\"\n" if (defined($title)) ; |
$gnuplot_input .= "set title \"$title\" font \"Helvetica,".$pt."pt\"\n" if (defined($title)) ; |
$gnuplot_input .= "set xlabel \"$xlabel\" font \"Helvetica,25pt\" \n" if (defined($xlabel)); |
$gnuplot_input .= "set xlabel \"$xlabel\" font \"Helvetica,".$pt."pt\" \n" if (defined($xlabel)); |
$gnuplot_input .= "set ylabel \"$ylabel\" font \"Helvetica,25pt\"\n" if (defined($ylabel)); |
$gnuplot_input .= "set ylabel \"$ylabel\" font \"Helvetica,".$pt."pt\"\n" if (defined($ylabel)); |
} else { |
} else { |
$gnuplot_input .= "set title \"$title\" \n" if (defined($title)) ; |
$gnuplot_input .= "set title \"$title\" \n" if (defined($title)) ; |
$gnuplot_input .= "set xlabel \"$xlabel\" \n" if (defined($xlabel)); |
$gnuplot_input .= "set xlabel \"$xlabel\" \n" if (defined($xlabel)); |
Line 1103 sub write_gnuplot_file {
|
Line 1111 sub write_gnuplot_file {
|
my $label; |
my $label; |
foreach $label (@labels) { |
foreach $label (@labels) { |
$gnuplot_input .= 'set label "'.$label->{'text'}.'" at '. |
$gnuplot_input .= 'set label "'.$label->{'text'}.'" at '. |
$label->{'xpos'}.','.$label->{'ypos'}.' '.$label->{'justify'}.' font "Helvetica,25pt"'.$/ ; |
$label->{'xpos'}.','.$label->{'ypos'}.' '.$label->{'justify'}.' font "Helvetica,'.$pt.'pt"'.$/ ; |
} |
} |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$gnuplot_input .="set size 1,".$plot{'height'}/$plot{'width'}*1.38; |
$gnuplot_input .="set size 1,".$plot{'height'}/$plot{'width'}*1.38; |