mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 13:29:26 +00:00
98_SVG.pm: ibars added (Forum #35268)
git-svn-id: https://svn.fhem.de/fhem/trunk@8263 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d695f7548f
commit
2e6a998280
@ -207,6 +207,8 @@ SVG_FwFn($$$$)
|
|||||||
"data-to='" .$SVG_devs{$d[0]}{to} ."' ".
|
"data-to='" .$SVG_devs{$d[0]}{to} ."' ".
|
||||||
"data-gplotFile='$gplot' source='$d[0]'>".
|
"data-gplotFile='$gplot' source='$d[0]'>".
|
||||||
"</div>";
|
"</div>";
|
||||||
|
$ret .= (SVG_PEdit($FW_wname,$d,$room,$pageHash) . "<br>")
|
||||||
|
if(!$pageHash);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +422,7 @@ SVG_PEdit($$$$)
|
|||||||
$o .= SVG_sel("axes_${idx}", "left,right",
|
$o .= SVG_sel("axes_${idx}", "left,right",
|
||||||
($v && $v eq "x1y1") ? "left" : "right");
|
($v && $v eq "x1y1") ? "left" : "right");
|
||||||
$o .= SVG_sel("type_${idx}",
|
$o .= SVG_sel("type_${idx}",
|
||||||
"lines,points,steps,fsteps,histeps,bars,".
|
"lines,points,steps,fsteps,histeps,bars,ibars,".
|
||||||
"cubic,quadratic,quadraticSmooth",
|
"cubic,quadratic,quadraticSmooth",
|
||||||
$conf{lType}[$idx]);
|
$conf{lType}[$idx]);
|
||||||
my $ls = $conf{lStyle}[$idx];
|
my $ls = $conf{lStyle}[$idx];
|
||||||
@ -1821,7 +1823,27 @@ SVG_render($$$$$$$$$$)
|
|||||||
"width=\"$x2\" height=\"$y2\"/>";
|
"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 "<rect $attributes $lStyle x=\"$x1\" y=\"$y1\" ".
|
||||||
|
"width=\"$bw\" height=\"$height\"/>";
|
||||||
|
}
|
||||||
|
}
|
||||||
} else { # lines and everything else
|
} else { # lines and everything else
|
||||||
my ($ymin, $ymax) = (99999999, -99999999);
|
my ($ymin, $ymax) = (99999999, -99999999);
|
||||||
my %lt =(cubic=>"C",quadratic=>"Q",quadraticSmooth=>"T");
|
my %lt =(cubic=>"C",quadratic=>"Q",quadraticSmooth=>"T");
|
||||||
|
Loading…
Reference in New Issue
Block a user