From 2e6a998280947697d4887806f21d2303450194da Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sun, 22 Mar 2015 13:10:37 +0000 Subject: [PATCH] 98_SVG.pm: ibars added (Forum #35268) git-svn-id: https://svn.fhem.de/fhem/trunk@8263 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_SVG.pm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/fhem/FHEM/98_SVG.pm b/fhem/FHEM/98_SVG.pm index 659137d5e..ea8842c59 100755 --- a/fhem/FHEM/98_SVG.pm +++ b/fhem/FHEM/98_SVG.pm @@ -207,6 +207,8 @@ SVG_FwFn($$$$) "data-to='" .$SVG_devs{$d[0]}{to} ."' ". "data-gplotFile='$gplot' source='$d[0]'>". ""; + $ret .= (SVG_PEdit($FW_wname,$d,$room,$pageHash) . "
") + if(!$pageHash); return $ret; } @@ -420,7 +422,7 @@ SVG_PEdit($$$$) $o .= SVG_sel("axes_${idx}", "left,right", ($v && $v eq "x1y1") ? "left" : "right"); $o .= SVG_sel("type_${idx}", - "lines,points,steps,fsteps,histeps,bars,". + "lines,points,steps,fsteps,histeps,bars,ibars,". "cubic,quadratic,quadraticSmooth", $conf{lType}[$idx]); my $ls = $conf{lStyle}[$idx]; @@ -1821,7 +1823,27 @@ SVG_render($$$$$$$$$$) "width=\"$x2\" height=\"$y2\"/>"; } } + } elsif( $lType eq "ibars" ) { # Forum #35268 + if(@{$dxp} == 1) { + my $y1 = $y+$h-($dyp->[0]-$min)*$hmul; + $ret .= sprintf(" %d,%d %d,%d %d,%d %d,%d", + $x,$y+$h, $x,$y1, $x+$w,$y1, $x+$w,$y+$h); + } else { + # interconnected bars (ibars): + # these bars will connect all datapoints. so the width of the bars + # might vary depending on the distance between data points + foreach my $i (1..int(@{$dxp})-1) { + my $x1 = $x + $dxp->[$i-1]; + my $y1 = $y +$h-($dyp->[$i]-$min)*$hmul; + my $x2 = $x + $dxp->[$i]; # used to calculate bar width later + + my $height = ($dyp->[$i]-$min)*$hmul; + my $bw = $x2 - $x1; + SVG_pO ""; + } + } } else { # lines and everything else my ($ymin, $ymax) = (99999999, -99999999); my %lt =(cubic=>"C",quadratic=>"Q",quadraticSmooth=>"T");