2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

98_SVG.pm: plotReplace changes (Forum #611802)

git-svn-id: https://svn.fhem.de/fhem/trunk@13822 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-03-27 20:00:19 +00:00
parent 657187bf94
commit 5f414d38cd

View File

@ -761,9 +761,11 @@ SVG_readgplotfile($$$)
my ($list, $pr) = parseParams($plotReplace) if($plotReplace);
if($plotReplace) {
for my $k (keys %$pr) {
if($pr->{$k} =~ m/^{.*}$/) {
if($k =~ m/^_/) {
$cmdFromAnalyze = $pr->{$k};
$pr->{$k} = eval $cmdFromAnalyze;
} elsif($pr->{$k} =~ m/^{.*}$/) {
delete $pr->{$k};
}
}
}
@ -831,7 +833,6 @@ SVG_substcfg($$$$$$)
my $fileesc = $file;
$fileesc =~ s/\\/\\\\/g; # For Windows, by MarkusRR
my $title = AttrVal($wl, "title", "\"$fileesc\"");
$title = AnalyzeCommand(undef, "{ $title }");
my $label = AttrVal($wl, "label", undef);
my @g_label;
@ -861,6 +862,21 @@ SVG_substcfg($$$$$$)
}
}
my $plotReplace = AttrVal($wl, "plotReplace", undef);
if($plotReplace) {
my ($list, $pr) = parseParams($plotReplace);
for my $k (keys %$pr) {
if($k !~ m/^_/) {
if($pr->{$k} =~ m/^{.*}$/) {
$cmdFromAnalyze = $pr->{$k};
$pr->{$k} = eval $cmdFromAnalyze;
}
$gplot_script =~ s/<$k>/$pr->{$k}/gs;
}
}
}
$plot =~ s/\r//g; # For our windows friends...
$gplot_script =~ s/\r//g;
@ -2515,7 +2531,13 @@ plotAsPng(@)
space separated list of key=value pairs. value may contain spaces if
enclosed in "" or {}. value will be evaluated, if it is enclosed in {}.
In the .gplot file &lt;key&gt; is replaced with the corresponding value.
Replaces the title, label and plotfunction attributes.
<br>
If the key starts with the _ character, &lt;key&gt; is replaced
<i>before</i> the input is processed, so it can be used to modify the
input processing parameters.<br> Else &lt;key&gt; is replaced
<i>after</i> the input is processed, so $data{min1} etc can be used.
plotReplace is the successor of the title, label and plotfunction
attributes.
</li><br>
</ul>
<br>
@ -2739,8 +2761,14 @@ plotAsPng(@)
perl-Ausdruck ausgewertet, falls es in {} eingeschlossen ist. In der
.gplot Datei werden alle &lt;Name&gt; Zeichenketten durch den
zugehoerigen Wert ersetzt.
<br>
Falls das erste Zeichen von Name _ ist, dann erfolgt die Ersetzung von
&lt;Name&gt; <i>vor</i> der Erzeugung der Inputdaten (damit man die
Parameter f&uuml;r die Erzeugung der Inputdaten bestimmen zu kann).
Sonst erfolgt sie <i>danach</i>, z.Bsp. um die $data{min1},usw Werte
verwenden zu k&ouml;nnen.
</li><br>
</ul>
</ul>
<br>
<a name="plotEditor"></a>