From 69433f2adc4c1f02765bf3276e9134e0fef42d5b Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Tue, 12 Dec 2017 21:34:48 +0000 Subject: [PATCH] 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 --- fhem/FHEM/92_FileLog.pm | 1 + fhem/FHEM/98_SVG.pm | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm index 154e2a4a1..f90237bf0 100644 --- a/fhem/FHEM/92_FileLog.pm +++ b/fhem/FHEM/92_FileLog.pm @@ -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; diff --git a/fhem/FHEM/98_SVG.pm b/fhem/FHEM/98_SVG.pm index 8b3f1241d..39950748f 100644 --- a/fhem/FHEM/98_SVG.pm +++ b/fhem/FHEM/98_SVG.pm @@ -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);