version 1.175, 2014/06/19 17:23:50
|
version 1.176, 2016/01/22 22:30:07
|
Line 258 my %gnuplot_defaults =
|
Line 258 my %gnuplot_defaults =
|
test => sub {$_[0]=~/^(left|right|middle|center)$/}, |
test => sub {$_[0]=~/^(left|right|middle|center)$/}, |
description => 'Alignment for image in HTML', |
description => 'Alignment for image in HTML', |
edit_type => 'choice', |
edit_type => 'choice', |
choices => ['left','right','middle'] |
choices => ['left','right','middle','center'] |
}, |
}, |
texwidth => { |
texwidth => { |
default => '93', |
default => '93', |
Line 739 sub end_gnuplot {
|
Line 739 sub end_gnuplot {
|
$filename = &escape($filename); |
$filename = &escape($filename); |
## return image tag for the plot |
## return image tag for the plot |
if ($target eq 'web') { |
if ($target eq 'web') { |
$result .= <<"ENDIMAGE"; |
my $srcatt = "src=\"/cgi-bin/plot.$weboutputformat?file=$filename.data\""; |
<img src = "/cgi-bin/plot.$weboutputformat?file=$filename.data" |
my $widthatt = "width=\"$Apache::lonplot::plot{'width'}\""; |
width = "$Apache::lonplot::plot{'width'}" |
my $heightatt = "height=\"$Apache::lonplot::plot{'height'}\""; |
height = "$Apache::lonplot::plot{'height'}" |
my $alignatt = "align=\"$Apache::lonplot::plot{'align'}\""; |
align = "$Apache::lonplot::plot{'align'}" |
my $altatt = "alt=\"$Apache::lonplot::plot{'alttag'}\""; |
alt = "$Apache::lonplot::plot{'alttag'}" /> |
if ($Apache::lonplot::plot{'align'} eq 'center') { |
ENDIMAGE |
$result .= '<div style="text-align:center">'. |
|
"<img $srcatt $widthatt $heightatt $altatt>". |
|
"</div>\n"; |
|
|
|
} else { |
|
$result .= "<img $srcatt $widthatt $heightatt $alignatt $altatt>"; |
|
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
&Apache::lonxml::debug(" gnuplot wid = $Apache::lonplot::plot{'width'}"); |
&Apache::lonxml::debug(" gnuplot wid = $Apache::lonplot::plot{'width'}"); |
&Apache::lonxml::debug(" gnuplot ht = $Apache::lonplot::plot{'height'}"); |
&Apache::lonxml::debug(" gnuplot ht = $Apache::lonplot::plot{'height'}"); |
Line 753 ENDIMAGE
|
Line 759 ENDIMAGE
|
&Apache::lonxml::register_ssi("/cgi-bin/plot.gif?file=$filename.data&output=eps"); |
&Apache::lonxml::register_ssi("/cgi-bin/plot.gif?file=$filename.data&output=eps"); |
$result = "%DYNAMICIMAGE:$Apache::lonplot::plot{'width'}:$Apache::lonplot::plot{'height'}:$Apache::lonplot::plot{'texwidth'}\n"; |
$result = "%DYNAMICIMAGE:$Apache::lonplot::plot{'width'}:$Apache::lonplot::plot{'height'}:$Apache::lonplot::plot{'texwidth'}\n"; |
$result .= '\graphicspath{{'.$tmpdir.'}}'."\n"; |
$result .= '\graphicspath{{'.$tmpdir.'}}'."\n"; |
|
if ($Apache::lonplot::plot{'align'} eq 'center') { |
|
$result .= '\begin{center}'; |
|
} |
$result .= '\includegraphics[width='.$Apache::lonplot::plot{'texwidth'}.' mm]{'.&unescape($filename).'.eps}'; |
$result .= '\includegraphics[width='.$Apache::lonplot::plot{'texwidth'}.' mm]{'.&unescape($filename).'.eps}'; |
|
if ($Apache::lonplot::plot{'align'} eq 'center') { |
|
$result .= '\end{center}'; |
|
} |
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.=&Apache::edit::tag_end($target,$token); |
$result.=&Apache::edit::tag_end($target,$token); |