mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
98_SVG.pm: evaluate fixedrange if enclosed in {} (Forum #137800)
git-svn-id: https://svn.fhem.de/fhem/trunk@28771 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9d472dc594
commit
efef531fec
@ -960,12 +960,13 @@ SVG_calcOffsets($$)
|
||||
my $frx; #fixedrange with offset
|
||||
if($defs{$wl}) {
|
||||
$fr = AttrVal($wl, "fixedrange", undef);
|
||||
$fr = AnalyzePerlCommand(undef,$1) if($fr && $fr =~ m/^{(.*)}$/); #137800
|
||||
if($fr) {
|
||||
if($fr =~ "^(hour|qday|day|week|month|year)" ||
|
||||
$fr =~ m/^\d+hour/ || #fixedrange with offset
|
||||
$fr =~ m/^\d+hour/ ||
|
||||
$fr =~ m/^\d+day/ ||
|
||||
$fr =~ m/^\d+year/ ) {
|
||||
$frx=$fr; #fixedrange with offset
|
||||
$frx = $fr;
|
||||
|
||||
} else {
|
||||
my @range = split(" ", $fr);
|
||||
@ -996,8 +997,11 @@ SVG_calcOffsets($$)
|
||||
$zoom = "day" if(!$zoom);
|
||||
$zoom = $fr if(defined($fr));
|
||||
$zoom = $frx if ($frx); #fixedrange with offset
|
||||
my @zrange = split(" ", $zoom); #fixedrange with offset
|
||||
if(defined($zrange[1])) { $off += $zrange[1]; $zoom=$zrange[0]; } #fixedrange with offset
|
||||
my @zrange = split(" ", $zoom);
|
||||
if(defined($zrange[1])) {
|
||||
$off += $zrange[1];
|
||||
$zoom=$zrange[0];
|
||||
}
|
||||
|
||||
my $endPlotNow = (SVG_Attr($FW_wname, $wl, "endPlotNow", undef) && !$st);
|
||||
if($zoom =~ m/^(\d+)?hour/) {
|
||||
@ -2664,8 +2668,10 @@ plotAsPng(@)
|
||||
|
||||
If given, the optional integer parameter offset refers to a different
|
||||
period (e.g. last year: fixedrange year -1, 2 days ago: fixedrange day
|
||||
-2).
|
||||
-2).<br>
|
||||
|
||||
If the attribute value is enclosed in {}, then it is evaluated first as
|
||||
a perl expression.
|
||||
</li><br>
|
||||
|
||||
<a id="SVG-attr-fixedoffset"></a>
|
||||
@ -2962,8 +2968,10 @@ plotAsPng(@)
|
||||
die anderen mit einem Zoom über eine Woche. Der optionale
|
||||
ganzzahlige Parameter [offset] setzt ein anderes Zeitintervall (z.B.
|
||||
letztes Jahr: <code>fixedrange year -1</code>, vorgestern: <code>
|
||||
fixedrange day -2</code>).
|
||||
fixedrange day -2</code>).<br>
|
||||
|
||||
Falls der Attributwert in {} eingeschlossen ist, dann wird er vor der
|
||||
weiteren Verarbeitung als Perl-Ausdruck ausgewertet.
|
||||
</li><br>
|
||||
|
||||
<a id="SVG-attr-label"></a>
|
||||
|
Loading…
Reference in New Issue
Block a user