From 64c82113d1287d4493ab2f8e468f4ce444618f8e Mon Sep 17 00:00:00 2001 From: Damian <> Date: Sun, 14 Feb 2021 11:23:37 +0000 Subject: [PATCH] 98_DOIF.pm: svg-functions ring, cylinder_bars improvements git-svn-id: https://svn.fhem.de/fhem/trunk@23740 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_DOIF.pm | 90 ++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/fhem/FHEM/98_DOIF.pm b/fhem/FHEM/98_DOIF.pm index e28fb92a6..37f955207 100644 --- a/fhem/FHEM/98_DOIF.pm +++ b/fhem/FHEM/98_DOIF.pm @@ -4690,7 +4690,7 @@ sub ring $ic="$ic\@".color($currColor,$ln) if ($icon !~ /@/); } - $out.= sprintf('',$size/100*(defined($icon)?61:60),$size/100*(defined($icon)?57:55)); + $out.= sprintf('',$size/100*61,$size/100*57); $out.= ''; $out.= ''; $out.= sprintf('\ @@ -4700,27 +4700,12 @@ sub ring '; $out.=''; - $out.=''; - $out.=sprintf(''); - $out.=describeArc(40, 30, (defined($icon)?27.5:26.5), 0, 280); + $out.=''; + $out.=sprintf(''); + $out.=describeArc(40, 30, 27.5, 0, 280); $out.=''; - ##$out.=sprintf(''); - ##$out.=describeArc(40, 30, 29, 0, 280); - ##$out.=''; - ##$out.=sprintf(''); - ##$out.=describeArc(40, 30, (defined($icon)?26:23), 0, 280); - ##$out.=''; - ##$out.=''; - ##$out.=describeArc(40, 30, (defined($icon)?27.5:26), 0, 1); - ##$out.=''; - ##$out.=''; - ##$out.=describeArc(40, 30, (defined($icon)?27.5:26), 279, 280); - ##$out.=''; - #$out.=sprintf('',color ($maxColor)); - #$out.=describeArc(40, 30, 26, 270, 280); - #$out.=''; - $out.=sprintf('',$currColor,$minColor,(defined $lr ? $lr:-1)); - $out.=describeArc(40, 30, (defined($icon)?27.5:26.5), 0, int($prop*280)); + $out.=sprintf('',$currColor,$minColor,(defined $lr ? $lr:-1)); + $out.=describeArc(40, 30, 27.5, 0, int($prop*280)); $out.=''; if (defined $icon and $icon ne "" and $icon ne " ") { $out.=''; @@ -4808,7 +4793,7 @@ sub ring2 } } - $out.= sprintf('',$size/100*60,$size/100*54); + $out.= sprintf('',$size/100*61,$size/100*57); $out.= ''; $out.= ''; $out.= sprintf('\ @@ -4821,34 +4806,19 @@ sub ring2 '; $out.=''; - $out.=''; - $out.=sprintf(''); - $out.=describeArc(40, 29, 25, 0, 280); + $out.=''; + $out.=sprintf(''); + $out.=describeArc(40, 30, 27.5, 0, 280); $out.=''; - ##$out.=sprintf(''); - ##$out.=describeArc(40, 30, 28.5, 0, 280); - ##$out.=''; - - ##$out.=sprintf(''); - ##$out.=describeArc(40, 30, 22, 0, 280); - ##$out.=''; - - + $out.=sprintf('',$currColor,$minColor,(defined $lr ? $lr:-1)); - $out.=describeArc(40, 29, 26, 0, int($prop*280)); + $out.=describeArc(40, 30, 27.5, 0, int($prop*280)); $out.=''; $out.=sprintf('',$currColor2,$minColor2,(defined $lr ? $lr:-1)); - $out.=describeArc(40, 29, 23.5, 0, int($prop2*280)); + $out.=describeArc(40, 30, 25, 0, int($prop2*280)); $out.=''; - ##$out.=''; - ##$out.=describeArc(40, 30, 25.2, 0, 1.5); - ##$out.=''; - - ##$out.=''; - ##$out.=describeArc(40, 30, 25.2, 279, 280.5); - ##$out.=''; $out.= sprintf('%s',color($currColor,$ln),sprintf($format,$val)); $out.= sprintf('%s',color($currColor,$ln),$unit) if (defined $unit); @@ -4927,14 +4897,27 @@ sub cylinder_mode my $ybegin; my $bheight; my $trans=0; + my $heightval=10; $size=100 if (!defined $size or $size eq ""); $dec=1 if (!defined $dec); my $format='%1.'.$dec.'f'; + my $heightcal=10+@values*10; + if (!defined $height or $height eq "") { - $height=10+@values*10 if (!defined $height or $height eq ""); - } + if (@values/3 > 4) { + $heightval=5; + $height=10+@values*5; + } else { + $height=$heightcal; + } + } else { + if ($height < $heightcal) { + $heightval=5; + } + } + if (!defined $header or $header eq "") { $trans=5; $bheight=$height-26; @@ -4960,6 +4943,9 @@ sub cylinder_mode } else { $bwidth=90+$lenmax*4.3; } + if ($heightval==5) { + $bwidth=$bwidth*1.3; + } } my ($y,$val1,$null); @@ -4998,11 +4984,11 @@ sub cylinder_mode $out.= sprintf('%s',$xBegin,$null+$heightoffset+2,0) if (defined $null); $out.= sprintf('%s',$xBegin,+$heightoffset,$max); - my $yBegin=13+($height-@values*10)/2; + my $yBegin=13+($height-@values*$heightval)/2; my $xValue=$xLeft; for (my $i=0;$i<@values;$i+=3){ - my $yValue=$yBegin+9; + my $yValue=$yBegin+$heightval-1; my $value=$values[$i]; my $val=$value; if (defined $mode) { @@ -5025,10 +5011,14 @@ sub cylinder_mode } if (defined $text and $text ne "") { - $out.= sprintf('%s',$xBegin+10,$yBegin+$i*10,hsl_color($color),$text.":"); - $yValue+=7; + $out.= sprintf('%s',$xBegin+10,$yBegin+$i*$heightval,hsl_color($color),$text.":"); + if ($heightval == 10) { + $yValue+=7; + } else { + $yValue-=4; + } } - $out.= sprintf('%s%s',$bwidth+5, $yValue+$i*10,hsl_color ($color),($val eq "N/A" ? $val:sprintf($format,$val)),$unit); + $out.= sprintf('%s%s',$bwidth+5, $yValue+$i*$heightval,hsl_color ($color),($val eq "N/A" ? $val:sprintf($format,$val)),$unit); } $out.= '';