From b5e14edc5886b84d20240fa316171cbaa99a5893 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Fri, 19 Sep 2014 16:05:56 +0000 Subject: [PATCH] FileLog/SVG: mindate/maxdate patches from justme1968 (Forum #26108) git-svn-id: https://svn.fhem.de/fhem/trunk@6571 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/92_FileLog.pm | 19 +++++++++++++++---- fhem/FHEM/98_SVG.pm | 12 ++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm index a5517a355..938dda781 100755 --- a/fhem/FHEM/92_FileLog.pm +++ b/fhem/FHEM/92_FileLog.pm @@ -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, max, avg, cnt, currdate, currval, sum +# mindate, min, maxdate, max, avg, cnt, currdate, +# currval, sum # for each requested column, beginning with = 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}. diff --git a/fhem/FHEM/98_SVG.pm b/fhem/FHEM/98_SVG.pm index 0ef198bf2..459e0b6bc 100755 --- a/fhem/FHEM/98_SVG.pm +++ b/fhem/FHEM/98_SVG.pm @@ -1717,9 +1717,9 @@ plotAsPng(@) expression, so you have access e.g. to the Value functions.

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:
+ 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:
  • Fixed text for the right and left axis:
    @@ -1904,9 +1904,9 @@ plotAsPng(@) Egal, ob es sich bei der Plotart um gnuplot-scroll oder SVG handelt, es können ebenfalls die Werte der individuellen Kurve für min, - max, avg, cnt, sum, currval (letzter Wert) und currdate (letztes Datum) - durch Zugriff der entsprechenden Werte über das DataHash verwendet - werden. Siehe untenstehendes Beispiel:
    + max, mindate, maxdate, avg, cnt, sum, currval (letzter Wert) und currdate + (letztes Datum) durch Zugriff der entsprechenden Werte über das + DataHash verwendet werden. Siehe untenstehendes Beispiel:
    • Beschriftunng der rechten und linken y-Achse: