mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 20:24:36 +00:00
SVG: add plotReplace Attribute (Forum #69241)
git-svn-id: https://svn.fhem.de/fhem/trunk@13733 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
10babe1a4b
commit
11e89a28ee
@ -68,6 +68,7 @@ SVG_Initialize($)
|
|||||||
plotWeekStartDay:0,1,2,3,4,5,6
|
plotWeekStartDay:0,1,2,3,4,5,6
|
||||||
plotfunction
|
plotfunction
|
||||||
plotsize
|
plotsize
|
||||||
|
plotReplace
|
||||||
startDate
|
startDate
|
||||||
title
|
title
|
||||||
);
|
);
|
||||||
@ -755,8 +756,21 @@ SVG_readgplotfile($$$)
|
|||||||
$srcDesc{all} = "";
|
$srcDesc{all} = "";
|
||||||
$srcDesc{order} = \@empty;
|
$srcDesc{order} = \@empty;
|
||||||
|
|
||||||
|
my $specval = AttrVal($wl, "plotfunction", undef);
|
||||||
|
my $plotReplace = AttrVal($wl, "plotReplace", undef);
|
||||||
|
my ($list, $pr) = parseParams($plotReplace) if($plotReplace);
|
||||||
|
if($plotReplace) {
|
||||||
|
for my $k (keys %$pr) {
|
||||||
|
if($pr->{$k} =~ m/^{.*}$/) {
|
||||||
|
$cmdFromAnalyze = $pr->{$k};
|
||||||
|
$pr->{$k} = eval $cmdFromAnalyze;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $l (@svgplotfile) {
|
foreach my $l (@svgplotfile) {
|
||||||
$l = "$l\n" unless $l =~ m/\n$/;
|
$l = "$l\n" unless $l =~ m/\n$/;
|
||||||
|
map { $l =~ s/<$_>/$pr->{$_}/ } keys %$pr if($plotReplace);
|
||||||
my ($src, $plotfn) = (undef, undef);
|
my ($src, $plotfn) = (undef, undef);
|
||||||
if($l =~ m/^#([^ ]*) (.*)$/) {
|
if($l =~ m/^#([^ ]*) (.*)$/) {
|
||||||
if($1 eq $ldType) {
|
if($1 eq $ldType) {
|
||||||
@ -773,7 +787,6 @@ SVG_readgplotfile($$$)
|
|||||||
if($plotfn) {
|
if($plotfn) {
|
||||||
Log 3, "$wl: space is not allowed in $ldType definition: $plotfn"
|
Log 3, "$wl: space is not allowed in $ldType definition: $plotfn"
|
||||||
if($plotfn =~ m/\s/);
|
if($plotfn =~ m/\s/);
|
||||||
my $specval = AttrVal($wl, "plotfunction", undef);
|
|
||||||
if ($specval) {
|
if ($specval) {
|
||||||
my @spec = split(" ",$specval);
|
my @spec = split(" ",$specval);
|
||||||
my $spec_count=1;
|
my $spec_count=1;
|
||||||
@ -2460,14 +2473,15 @@ plotAsPng(@)
|
|||||||
</ul>
|
</ul>
|
||||||
The value minAll and maxAll (representing the minimum/maximum over all
|
The value minAll and maxAll (representing the minimum/maximum over all
|
||||||
values) is also available from the data hash.
|
values) is also available from the data hash.
|
||||||
|
<br>Deprecated, see plotReplace.
|
||||||
</li>
|
</li><br>
|
||||||
|
|
||||||
<a name="title"></a>
|
<a name="title"></a>
|
||||||
<li>title<br>
|
<li>title<br>
|
||||||
A special form of label (see above), which replaces the string <TL>
|
A special form of label (see above), which replaces the string <TL>
|
||||||
in the .gplot file. It defaults to the filename of the logfile.
|
in the .gplot file. It defaults to the filename of the logfile.
|
||||||
</li>
|
<br>Deprecated, see plotReplace.
|
||||||
|
</li><br>
|
||||||
|
|
||||||
<a name="captionLeft"></a>
|
<a name="captionLeft"></a>
|
||||||
<li>captionLeft<br>
|
<li>captionLeft<br>
|
||||||
@ -2493,7 +2507,16 @@ plotAsPng(@)
|
|||||||
#DbLog Garage_Raumtemp:temperature::
|
#DbLog Garage_Raumtemp:temperature::
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
Deprecated, see plotReplace.
|
||||||
|
</li><br>
|
||||||
|
|
||||||
|
<a name="plotReplace"></a>
|
||||||
|
<li>plotReplace<br>
|
||||||
|
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 <key> is replaced with the corresponding value.
|
||||||
|
Replaces the title, label and plotfunction attributes.
|
||||||
|
</li><br>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@ -2664,6 +2687,7 @@ plotAsPng(@)
|
|||||||
</ul>
|
</ul>
|
||||||
Die Werte minAll und maxAll (die das Minimum/Maximum aller Werte
|
Die Werte minAll und maxAll (die das Minimum/Maximum aller Werte
|
||||||
repräsentieren) sind ebenfals im data hash vorhanden.
|
repräsentieren) sind ebenfals im data hash vorhanden.
|
||||||
|
<br>Überholt, wird durch das plotReplace Attribut abgelöst.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<a name="title"></a>
|
<a name="title"></a>
|
||||||
@ -2672,6 +2696,7 @@ plotAsPng(@)
|
|||||||
Zeichenfolge <TL> in der .gplot-Datei ersetzt wird.
|
Zeichenfolge <TL> in der .gplot-Datei ersetzt wird.
|
||||||
Standardmäßig wird als <TL> der Dateiname des Logfiles
|
Standardmäßig wird als <TL> der Dateiname des Logfiles
|
||||||
eingesetzt.
|
eingesetzt.
|
||||||
|
<br>Überholt, wird durch das plotReplace Attribut abgelöst.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
<a name="captionLeft"></a>
|
<a name="captionLeft"></a>
|
||||||
@ -2704,7 +2729,17 @@ plotAsPng(@)
|
|||||||
<code>#DbLog Garage_Raumtemp:temperature::</code>
|
<code>#DbLog Garage_Raumtemp:temperature::</code>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
Überholt, wird durch das plotReplace Attribut abgelöst.
|
||||||
|
</li><br>
|
||||||
|
|
||||||
|
<a name="plotReplace"></a>
|
||||||
|
<li>plotReplace<br>
|
||||||
|
Leerzeichen getrennte Liste von Name=Wert Paaren. Wert kann Leerzeichen
|
||||||
|
enthalten, falls es in "" oder {} eingeschlossen ist. Wert wird als
|
||||||
|
perl-Ausdruck ausgewertet, falls es in {} eingeschlossen ist. In der
|
||||||
|
.gplot Datei werden alle <Name> Zeichenketten durch den
|
||||||
|
zugehoerigen Wert ersetzt.
|
||||||
|
</li><br>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@ -2998,7 +2998,7 @@ SignalHandling()
|
|||||||
$data{WARNING}{$msg}++;
|
$data{WARNING}{$msg}++;
|
||||||
chomp($msg);
|
chomp($msg);
|
||||||
Log 1, "PERL WARNING: $msg";
|
Log 1, "PERL WARNING: $msg";
|
||||||
Log 3, "eval: $cmdFromAnalyze" if($cmdFromAnalyze && $msg =~ m/\(eval /);
|
Log 3, "eval: $cmdFromAnalyze" if($cmdFromAnalyze);
|
||||||
stacktrace() if($attr{global}{stacktrace} &&
|
stacktrace() if($attr{global}{stacktrace} &&
|
||||||
$msg !~ m/ redefined at /);
|
$msg !~ m/ redefined at /);
|
||||||
$inWarnSub = 0;
|
$inWarnSub = 0;
|
||||||
@ -4856,8 +4856,8 @@ parseParams($;$)
|
|||||||
$value = $key;
|
$value = $key;
|
||||||
$key = undef;
|
$key = undef;
|
||||||
|
|
||||||
# the key can not start with a { -> it must be a perl expression
|
# the key can not start with a { -> it must be a perl expression # vim:}
|
||||||
} elsif( $key =~ m/^\s*{/ ) {
|
} elsif( $key =~ m/^\s*{/ ) { # for vim: }
|
||||||
$value = $param;
|
$value = $param;
|
||||||
$key = undef;
|
$key = undef;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user