2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 01:46:08 +00:00

FileLog/SVG: mindate/maxdate patches from justme1968 (Forum #26108)

git-svn-id: https://svn.fhem.de/fhem/trunk@6571 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-09-19 16:05:56 +00:00
parent 3890d58b53
commit b5e14edc58
2 changed files with 21 additions and 10 deletions

View File

@ -499,7 +499,8 @@ FileLog_logWrapper($)
# - delta-h / delta-d to get rain/h and rain/d values from continuous data.
#
# It will set the %data values
# min<x>, max<x>, avg<x>, cnt<x>, currdate<x>, currval<x>, sum<x>
# mindate<x>, min<x>, maxdate<x>, max<x>, avg<x>, cnt<x>, currdate<x>,
# currval<x>, sum<x>
# for each requested column, beginning with <x> = 1
sub
@ -585,7 +586,7 @@ FileLog_Get($@)
# last2: last delta value recorded (for the very last entry)
# last3: last delta timestamp (d or h)
my (@d, @fname);
my (@min, @max, @sum, @cnt, @lastv, @lastd);
my (@min, @max, @sum, @cnt, @lastv, @lastd, @mind, @maxd);
for(my $i = 0; $i < int(@a); $i++) {
my @fld = split(":", $a[$i], 4);
@ -621,6 +622,8 @@ FileLog_Get($@)
$cnt[$i] = 0;
$lastv[$i] = 0;
$lastd[$i] = "undef";
$mind[$i] = "undef";
$maxd[$i] = "undef";
}
my %lastdate;
@ -698,8 +701,14 @@ RESCAN:
}
next if(!defined($val) || $val !~ m/^[-\.\d]+$/o);
$min[$i] = $val if($val < $min[$i]);
$max[$i] = $val if($val > $max[$i]);
if($val < $min[$i]) {
$min[$i] = $val;
$mind[$i] = $dte;
}
if($val > $max[$i]) {
$max[$i] = $val;
$maxd[$i] = $dte;
}
$sum[$i] += $val;
$cnt[$i]++;
$lastv[$i] = $val;
@ -791,6 +800,8 @@ RESCAN:
$data{"cnt$j"} = $cnt[$i] ? $cnt[$i] : "undef";
$data{"currval$j"} = $lastv[$i];
$data{"currdate$j"} = $lastd[$i];
$data{"mindate$j"} = $mind[$i];
$data{"maxdate$j"} = $maxd[$i];
Log3 $name, 4,
"$name get: line $j, regexp:".$d[$i]->{re}.", col:".$d[$i]->{col}.

View File

@ -1717,9 +1717,9 @@ plotAsPng(@)
expression, so you have access e.g. to the Value functions.<br><br>
If the plotmode is gnuplot-scroll or SVG, you can also use the min, max,
avg, cnt, sum, currval (last value) and currdate (last date) values of
the individual curves, by accessing the corresponding values from the
data hash, see the example below:<br>
mindate, maxdate, avg, cnt, sum, currval (last value) and currdate (last
date) values of the individual curves, by accessing the corresponding
values from the data hash, see the example below:<br>
<ul>
<li>Fixed text for the right and left axis:<br>
@ -1904,9 +1904,9 @@ plotAsPng(@)
Egal, ob es sich bei der Plotart um gnuplot-scroll oder SVG handelt, es
k&ouml;nnen ebenfalls die Werte der individuellen Kurve f&uuml;r min,
max, avg, cnt, sum, currval (letzter Wert) und currdate (letztes Datum)
durch Zugriff der entsprechenden Werte &uuml;ber das DataHash verwendet
werden. Siehe untenstehendes Beispiel:<br>
max, mindate, maxdate, avg, cnt, sum, currval (letzter Wert) und currdate
(letztes Datum) durch Zugriff der entsprechenden Werte &uuml;ber das
DataHash verwendet werden. Siehe untenstehendes Beispiel:<br>
<ul>
<li>Beschriftunng der rechten und linken y-Achse:<br>
<ul>