From be803d2f3734b085909005a51ac36e075b436a60 Mon Sep 17 00:00:00 2001 From: Damian <> Date: Sat, 2 May 2020 16:00:20 +0000 Subject: [PATCH] 98_DOIF.pm: new svg uiTable functions: temp_temp_ring, hum_bar git-svn-id: https://svn.fhem.de/fhem/trunk@21842 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_DOIF.pm | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/98_DOIF.pm b/fhem/FHEM/98_DOIF.pm index 8fa4c4473..2d94e23e9 100644 --- a/fhem/FHEM/98_DOIF.pm +++ b/fhem/FHEM/98_DOIF.pm @@ -102,7 +102,7 @@ sub DOIF_Initialize($) $hash->{FW_deviceOverview} = 1; $hash->{FW_addDetailToSummary} = 1; $hash->{FW_detailFn} = "DOIF_detailFn"; - $hash->{FW_summaryFn} = "DOIF_summaryFn"; + #hash->{FW_summaryFn} = "DOIF_summaryFn"; #$hash->{FW_atPageEnd} = 1; $data{FWEXT}{DOIF}{SCRIPT} = "doif.js"; @@ -4098,6 +4098,14 @@ sub temp_bar { return(bar($value,$min,$max,$header,undef,undef,"°C",$width,$height,$size,\&temp_hue,1)); } +sub hum_bar { + my ($value,$header,$width,$height,$size) = @_; + + $width=60 if (!defined $width); + return(bar($value,0,100,$header,undef,undef,"%",$width,$height,$size,\&hum_hue,0)); +} + + sub polarToCartesian { my ($centerX,$centerY,$radius,$angleInDegrees)=@_; my $angleInRadians = ($angleInDegrees-230) * ::pi() / 180.0; @@ -4152,6 +4160,17 @@ sub temp_hum_ring { return(ring2($value,$min,$max,undef,undef,"°C",$size,\&temp_hue,1,$value2,0,100,0,0,"%",\&hum_hue,0)); } +sub temp_temp_ring { + my ($value,$value2,$min,$max,$size) = @_; + $min=-20 if (!defined $min); + $max=60 if (!defined $max); + $size=90 if (!defined $size); + return(ring2($value,$min,$max,undef,undef,"°C",$size,\&temp_hue,1,$value2,$min,$max,undef,undef,"°C",\&temp_hue,1)); +} + + + + sub ring { my ($value,$min,$max,$minColor,$maxColor,$unit,$size,$func,$dec) = @_; @@ -4374,7 +4393,7 @@ sub y_h } my $prop=$value/($max-$min); - my $h=abs($prop*($height))+4; + my $h=int(abs($prop*($height))+4.5); my $y; my $null; @@ -4382,7 +4401,7 @@ sub y_h if ($value <= 0) { $y=$null; } else { - $y=$null+4.9-$h; + $y=int($null+4.5-$h); } $null=undef if ($max == 0 or $min == 0); return ($y,$h,$null); @@ -4456,7 +4475,9 @@ sub cylinder $out.= sprintf('%s',$null+6,0) if (defined $null); $out.= sprintf('%s',8,$max); + my $yBegin=14+($height-@values*12)/2; for (my $i=0;$i<@values;$i+=3){ + my $yValue=$yBegin+12; my $value=$values[$i]; my $color=$values[$i+1]; my $text=$values[$i+2]; @@ -4465,8 +4486,11 @@ sub cylinder $out.= sprintf('',$y,$width,$val1,$color); # $out.= sprintf('',$y,$width,$color); $out.= sprintf('',$y,$width); - $out.= sprintf('%s',20+$i*12,color($color),$text.":") if ($text ne ""); - $out.= sprintf('%s%s',$bwidth+5, 39+$i*12,color ($color),sprintf($format,$value),$unit); + if (defined $text and $text ne "") { + $out.= sprintf('%s',$yBegin+$i*12,color($color),$text.":"); + $yValue+=7; + } + $out.= sprintf('%s%s',$bwidth+5, $yValue+$i*12,color ($color),sprintf($format,$value),$unit); } $out.= sprintf('',$width);