diff --git a/fhem/webfrontend/pgm2/01_FHEMWEB.pm b/fhem/webfrontend/pgm2/01_FHEMWEB.pm index 4cb75884c..df9153f61 100755 --- a/fhem/webfrontend/pgm2/01_FHEMWEB.pm +++ b/fhem/webfrontend/pgm2/01_FHEMWEB.pm @@ -21,6 +21,7 @@ sub FW_showWeblink($$$); sub FW_select($$$); sub FW_textfield($$); sub FW_submit($$); +sub FW_substcfg($$$$$$); sub FW_style($$); sub FW_roomOverview($); sub FW_fatal($); @@ -851,7 +852,7 @@ FW_substcfg($$$$$$) { my ($splitret, $wl, $cfg, $plot, $file, $tmpfile) = @_; - # interprete title and label as a perl command and open accessiblity + # interpret title and label as a perl command and make # to all internal values e.g. $value. my $oll = $attr{global}{verbose}; @@ -886,9 +887,9 @@ FW_substcfg($$$$$$) } } - if($splitret) { + if($splitret == 1) { my @ret = split("\n", $gplot_script); - return \@ret; + return (\@ret, $plot); } else { return $gplot_script; } @@ -995,7 +996,7 @@ FW_showLog($) Log 0, $ret if($ret); } $ret = fC("get $d $file INT $f $t " . join(" ", @{$flog})); - $cfg = FW_substcfg(1, $wl, $cfg, $plot, $file, ""); + ($cfg, $plot) = FW_substcfg(1, $wl, $cfg, $plot, $file, ""); SVG_render($f, $t, $cfg, $internal_data, $plot); $__RETTYPE = "image/svg+xml"; diff --git a/fhem/webfrontend/pgm2/98_SVG.pm b/fhem/webfrontend/pgm2/98_SVG.pm index 108a5d8c0..cac3cb411 100755 --- a/fhem/webfrontend/pgm2/98_SVG.pm +++ b/fhem/webfrontend/pgm2/98_SVG.pm @@ -112,8 +112,10 @@ SVG_render($$$$$) $dpoff = $ndpoff+1; if($l =~ m/^#/) { my $a = $axes[$idx]; - $hmin{$a} = $min if(!defined($hmin{$a}) || $hmin{$a} > $min); - $hmax{$a} = $max if(!defined($hmax{$a}) || $hmax{$a} < $max); + if(defined($a)) { + $hmin{$a} = $min if(!defined($hmin{$a}) || $hmin{$a} > $min); + $hmax{$a} = $max if(!defined($hmax{$a}) || $hmax{$a} < $max); + } ($min, $max) = (99999999, -99999999); $hdx[$idx] = $dxp; $hdy[$idx] = $dyp; ($dxp, $dyp) = (\(), \()); @@ -208,6 +210,7 @@ SVG_render($$$$$) for my $axis ("x1y1", "x1y2") { # Round values, compute a nice step + next if(!defined($hmax{$axis})); my $dh = $hmax{$axis} - $hmin{$axis}; my ($step, $mi, $ma); my @limit = (1,2,5,10,20,50,100,200,500,1000,2000,5000,10000); @@ -279,6 +282,7 @@ SVG_render($$$$$) # Second loop over the data: draw the measured points for my $idx (0..int(@hdx)-1) { my $a = $axes[$idx]; + next if(!defined($a)); $min = $hmin{$a}; $hmax{$a} += 1 if($min == $hmax{$a}); # Else division by 0 in the next line my $hmul = $h/($hmax{$a}-$min);