2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 23:06:05 +00:00

98_SVG.pm: firstdate/firstval added (Forum #37069)

git-svn-id: https://svn.fhem.de/fhem/trunk@8575 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-05-14 08:41:10 +00:00
parent adf536f1e5
commit e68098f571
2 changed files with 15 additions and 4 deletions

View File

@ -599,7 +599,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, @mind, @maxd);
my (@min, @max, @sum, @cnt, @lastv, @lastd, @mind, @maxd, @firstv, @firstd);
for(my $i = 0; $i < int(@a); $i++) {
my @fld = split(":", $a[$i], 4);
@ -635,6 +635,8 @@ FileLog_Get($@)
$cnt[$i] = 0;
$lastv[$i] = 0;
$lastd[$i] = "undef";
$firstv[$i] = 0;
$firstd[$i] = "undef";
$mind[$i] = "undef";
$maxd[$i] = "undef";
}
@ -729,6 +731,10 @@ RESCAN:
}
$sum[$i] += $val;
$cnt[$i]++;
if($firstd[$i] eq "undef") {
$firstv[$i] = $val;
$firstd[$i] = $dte;
}
$lastv[$i] = $val;
$lastd[$i] = $dte;
map { $cnt[$i]++; $min[$i] = 0 if(0 < $min[$i]); } @missingvals;
@ -818,6 +824,8 @@ RESCAN:
$data{"cnt$j"} = $cnt[$i] ? $cnt[$i] : "undef";
$data{"currval$j"} = $lastv[$i];
$data{"currdate$j"} = $lastd[$i];
$data{"firstval$j"} = $firstv[$i];
$data{"firstdate$j"} = $firstd[$i];
$data{"mindate$j"} = $mind[$i];
$data{"maxdate$j"} = $maxd[$i];
$data{"lastraw$j"} = $h->{last2} if($h->{last2});

View File

@ -1105,7 +1105,8 @@ SVG_getData($$$$$)
{
my ($d, $f,$t,$srcDesc,$showData) = @_;
my (@da, $ret, @vals);
my @keys = ("min","max","avg","cnt","currval","mindate","maxdate","lastraw");
my @keys = ("min","mindate","max","maxdate","currval","currdate",
"firstval","firstdate","avg","cnt","lastraw");
foreach my $src (@{$srcDesc->{order}}) {
my $s = $srcDesc->{src}{$src};
@ -2331,8 +2332,10 @@ 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,
mindate, maxdate, avg, cnt, sum, currval (last value) and currdate (last
date) values of the individual curves, by accessing the corresponding
mindate, maxdate, avg, cnt, sum, firstval, firstdate, 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>