2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

98_SVG.pm/92_FileLog.pm: fix $data{sumX} for multi-source plot (Forum #80966)

git-svn-id: https://svn.fhem.de/fhem/trunk@15597 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-12-12 21:34:48 +00:00
parent e2b290c02d
commit 69433f2adc
2 changed files with 5 additions and 2 deletions

View File

@ -913,6 +913,7 @@ RESCAN:
}
my $j = $i+1;
$j += $data{svgOffset} if($data{svgOffset});
$data{"min$j"} = $min[$i];
$data{"max$j"} = $max[$i];
$data{"avg$j"} = $cnt[$i] ? sprintf("%0.1f", $sum[$i]/$cnt[$i]) : 0;

View File

@ -753,7 +753,7 @@ SVG_WriteGplot($)
# - {src}{X}: hash (X is an order element), consisting of
# {arg}: plot arguments for one dev, space separated
# {idx}: number of lines requested from the same source
# {num}: number or this src in the order array
# {num}: number of this src in the order array
# - {rev}{orderIdx}{localIdx} = N: reverse lookup of the plot argument index,
# using {src}{X}{num} as orderIdx and {src}{X}{idx} as localIdx
sub
@ -1211,6 +1211,7 @@ SVG_getData($$$$$)
my @keys = ("min","mindate","max","maxdate","currval","currdate",
"firstval","firstdate","avg","cnt","lastraw");
$data{svgOffset} = 0;
foreach my $src (@{$srcDesc->{order}}) {
my $s = $srcDesc->{src}{$src};
my $fname = ($src eq $defs{$d}{LOGDEVICE} ? $defs{$d}{LOGFILE} : "CURRENT");
@ -1229,9 +1230,10 @@ SVG_getData($$$$$)
}
push @vals, \%h;
}
$data{svgOffset} += ($s->{idx}+1);
}
}
delete($data{svgOffset});
# Reorder the $data{maxX} stuff
my ($min, $max) = (999999, -999999);