98_SVG.pm: fix gnuplot-scroll and gnuplot-scroll-svg

git-svn-id: https://svn.fhem.de/fhem/trunk@16656 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-04-24 21:12:43 +00:00
parent ba206c4990
commit cfe1ee51bd

View File

@ -70,7 +70,7 @@ SVG_Initialize($)
nrAxis nrAxis
plotWeekStartDay:0,1,2,3,4,5,6 plotWeekStartDay:0,1,2,3,4,5,6
plotfunction plotfunction
plotmode plotmode:gnuplot-scroll,gnuplot-scroll-svg,SVG
plotsize plotsize
plotReplace:textField-long plotReplace:textField-long
startDate startDate
@ -1163,21 +1163,23 @@ SVG_doShowLog($$$$;$)
my $gplot_script = SVG_substcfg(0, $wl, $cfg, $plot, $file, $tmpfile); my $gplot_script = SVG_substcfg(0, $wl, $cfg, $plot, $file, $tmpfile);
$gplot_script =~ s/<TMPFILE>/$tmpfile/g; $gplot_script =~ s/<TMPFILE>/$tmpfile/g;
$plot =~ s/ls \w+//g;
open(FH, "|gnuplot >> $errfile 2>&1");# feed it to gnuplot
print FH $gplot_script;
close(FH);
unlink($tmpfile);
my $ext; my $ext;
if($pm eq "gnuplot-scroll") { if($pm eq "gnuplot-scroll") {
$FW_RETTYPE = "image/png"; $FW_RETTYPE = "image/png";
$ext = "png"; $ext = "png";
} }
else { else {
$gplot_script =~ s/set terminal png transparent/set terminal svg/;
$gplot_script =~ s/set terminal (.*) crop/set terminal $1/;
$gplot_script =~ s/set output (.*).png'/set output $1.svg'/;
$FW_RETTYPE = "image/svg+xml"; $FW_RETTYPE = "image/svg+xml";
$ext = "svg"; $ext = "svg";
} }
$gplot_script =~ s/ls \w+//g;
open(FH, "|gnuplot >> $errfile 2>&1");# feed it to gnuplot
print FH $gplot_script;
close(FH);
unlink($tmpfile);
open(FH, "$tmpfile.$ext"); # read in the result and send it open(FH, "$tmpfile.$ext"); # read in the result and send it
binmode (FH); # necessary for Windows binmode (FH); # necessary for Windows