mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 13:26:02 +00:00
98_DOIF.pm: svg bar functions: position improvements
git-svn-id: https://svn.fhem.de/fhem/trunk@24019 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
101a8dc7b0
commit
57af5687dd
@ -4331,7 +4331,7 @@ sub bar
|
||||
$unit="" if (!defined $unit);
|
||||
if (!defined $bheight) {
|
||||
if (defined ($icon)) {
|
||||
$bheight=80;
|
||||
$bheight=75;
|
||||
} else {
|
||||
$bheight=60;
|
||||
}
|
||||
@ -4352,7 +4352,8 @@ sub bar
|
||||
|
||||
$dec=1 if (!defined $dec);
|
||||
|
||||
$ypos=int(($height-44)/3+10);
|
||||
|
||||
$ypos= (defined ($icon) and $bheight >= 75) ? int($height/2-3):int($height/2+3);
|
||||
|
||||
($format,$value,$val)=format_value($val,$min,$dec);
|
||||
|
||||
@ -4397,9 +4398,9 @@ sub bar
|
||||
$ix=$bwidth/2+3;
|
||||
};
|
||||
if (defined ($iy)) {
|
||||
$iy+=$ypos;
|
||||
$iy+=($ypos-14);
|
||||
} else {
|
||||
$iy=$ypos;
|
||||
$iy=($ypos-14);
|
||||
};
|
||||
$rotate=0 if (!defined $rotate);
|
||||
$iscale=1 if (!defined $iscale);
|
||||
@ -4458,27 +4459,27 @@ sub bar
|
||||
my ($valInt,$valDec)=split(/\./,sprintf($format,$val));
|
||||
|
||||
|
||||
if ($bheight>=80 or !defined ($icon) and $bheight >= 50) {
|
||||
if ($bheight>=75 or !defined ($icon) and $bheight >= 50) {
|
||||
if (defined $valDec) {
|
||||
$out.= sprintf('<text text-anchor="middle" x="%d" y="%d" style="fill:%s"><tspan style="font-size:16px;font-weight:bold;%s">%s<tspan style="font-size:85%%;">.%s</tspan></tspan></text>',
|
||||
$bwidth/2+15,(defined ($icon) ? $ypos+38:$ypos+20),color($currColor,$ln),$fontformat,$valInt,$valDec);
|
||||
$bwidth/2+15,(defined ($icon) ? $ypos+23:$ypos+5),color($currColor,$ln),$fontformat,$valInt,$valDec);
|
||||
|
||||
$out.= sprintf('<text text-anchor="middle" x="%d" y="%d" style="fill:%s"><tspan style="font-size:10px;%s">%s</tspan></text>',
|
||||
$bwidth/2+15,(defined ($icon) ? $ypos+49:$ypos+31),color($currColor,$ln),$unitformat,$unit);
|
||||
$bwidth/2+15,(defined ($icon) ? $ypos+34:$ypos+16),color($currColor,$ln),$unitformat,$unit);
|
||||
} else {
|
||||
$out.= sprintf('<text text-anchor="middle" x="%d" y="%d" style="fill:%s"><tspan style="font-size:16px;font-weight:bold;%s">%s</tspan></text>',
|
||||
$bwidth/2+15,(defined ($icon) ? $ypos+38:$ypos+20),color($currColor,$ln),$fontformat,$valInt);
|
||||
$bwidth/2+15,(defined ($icon) ? $ypos+23:$ypos+5),color($currColor,$ln),$fontformat,$valInt);
|
||||
|
||||
$out.= sprintf('<text text-anchor="middle" x="%d" y="%d" style="fill:%s"><tspan style="font-size:10px;%s">%s</tspan></text>',
|
||||
$bwidth/2+15,(defined ($icon) ? $ypos+49:$ypos+31),color($currColor,$ln),$unitformat,$unit);
|
||||
$bwidth/2+15,(defined ($icon) ? $ypos+34:$ypos+16),color($currColor,$ln),$unitformat,$unit);
|
||||
}
|
||||
} else {
|
||||
if (defined $valDec) {
|
||||
$out.= sprintf('<text text-anchor="end" x="%d" y="%d" style="fill:%s"><tspan style="font-size:16px;font-weight:bold;%s">%s<tspan style="font-size:85%%;">.%s</tspan></tspan><tspan dx="2" style="font-size:10px;%s">%s</tspan></text>',
|
||||
$bwidth+6,(defined ($icon) ? $height/2+25:$height/2+12),color($currColor,$ln),$fontformat,$valInt,$valDec,$unitformat,$unit);
|
||||
$out.= sprintf('<text text-anchor="middle" x="%d" y="%d" style="fill:%s"><tspan style="font-size:16px;font-weight:bold;%s">%s<tspan style="font-size:85%%;">.%s</tspan></tspan><tspan dx="2" style="font-size:10px;%s">%s</tspan></text>',
|
||||
$bwidth/2+15,(defined ($icon) ? $height/2+25:$height/2+12),color($currColor,$ln),$fontformat,$valInt,$valDec,$unitformat,$unit);
|
||||
} else {
|
||||
$out.= sprintf('<text text-anchor="end" x="%d" y="%d" style="fill:%s"><tspan style="font-size:16px;font-weight:bold;%s">%s</tspan><tspan dx="2" style="font-size:10px;%s">%s</tspan></text>',
|
||||
$bwidth+6,(defined ($icon) ? $height/2+25:$height/2+12),color($currColor,$ln),$fontformat,$valInt,$unitformat,$unit);
|
||||
$out.= sprintf('<text text-anchor="middle" x="%d" y="%d" style="fill:%s"><tspan style="font-size:16px;font-weight:bold;%s">%s</tspan><tspan dx="2" style="font-size:10px;%s">%s</tspan></text>',
|
||||
$bwidth/2+15,(defined ($icon) ? $height/2+25:$height/2+12),color($currColor,$ln),$fontformat,$valInt,$unitformat,$unit);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user