diff --git a/FHEM/98_DOIF.pm b/FHEM/98_DOIF.pm index 0f5b7a5db..b3bacb325 100644 --- a/FHEM/98_DOIF.pm +++ b/FHEM/98_DOIF.pm @@ -4534,7 +4534,6 @@ sub card my $svg_width=int($size/100*$bwidth); my $svg_height=int($size/100*$bheight); - my ($m,$n)=m_n($min,0,$max,50); my $xpos; my $nullColor; my $nullProp; @@ -4543,7 +4542,16 @@ sub card my $bottomVal; my $bottomOpacity; my $nullOpacity; - if ($min < 0 and $max > 0) { + my $minPlot=($min < 0 and $minValPlot > 0) ? 0:$min; + my $maxPlot=($max > 0 and $maxValPlot < 0) ? 0:$max; + + ##my $maxPlot=($maxValPlot < $max/2.1) ? $max/2:$max; + my ($m,$n)=m_n($minPlot,0,$maxPlot,50); + + ($minColor)= get_color($minPlot,$min,$max,$minColor,$maxColor,$func); + ($maxColor)= get_color($maxPlot,$min,$max,$minColor,$maxColor,$func); + + if ($minPlot < 0 and $maxPlot > 0) { $xpos=50-int($n*10)/10; $topVal=($maxValPlot > 0 ? $maxValPlot : 0); $bottomVal=($minValPlot < 0 ? $minValPlot : 0); @@ -4553,9 +4561,9 @@ sub card $topOpacity=($topVal==0 ? 0 : 0.25); $bottomOpacity=($bottomVal==0 ? 0: 0.25); $nullOpacity=0.0; - } elsif ($max <= 0) { + } elsif ($maxPlot <= 0) { $xpos=0; - $topVal=$max; + $topVal=$maxPlot; $topOpacity=0.0; $bottomOpacity=0.25; $bottomVal=$minValPlot; @@ -4564,7 +4572,7 @@ sub card $topVal=$maxValPlot; $topOpacity=0.25; $bottomOpacity=0.0; - $bottomVal=$min; + $bottomVal=$minPlot; } $ic="$ic\@".color($currColor,$ln) if (defined($icon) and $icon !~ /@/); @@ -4590,7 +4598,7 @@ sub card $out.= sprintf('',$bwidth-2,$bheight); if (defined $header) { - $out.= sprintf('%s',$header_style,$header_txt); + $out.= sprintf('%s',$header_style,$header_txt); if (defined $icon and $icon ne "" and $icon ne " ") { my $svg_icon=::FW_makeImage($ic); if(!($svg_icon =~ s/\sheight="[^"]*"/ height="22"/)) { @@ -4605,10 +4613,10 @@ sub card } $out.=''; } - $out.= sprintf('',$htrans); + $out.= sprintf('',$htrans); $out.=''; $out.= ''; - $out.= ''; + $out.= ''; my $points=""; my $first=1; @@ -4639,14 +4647,14 @@ sub card $out.=sprintf(',',$minValSlot,(50-int((${$a}[$minValSlot]*$m+$n)*10)/10),color($minValColor,$ln)) if (defined $minVal and $minValSlot != 59); $out.=sprintf(' ',(50-int(($val*$m+$n)*10)/10),color($currColor,$ln)); - $out.= sprintf('%s',color($maxColor,$lmm),"",$max); - $out.= sprintf('%s',color($minColor,$lmm),"",$min); + $out.= sprintf('%s',color($maxColor,$lmm),"",$maxPlot); + $out.= sprintf('%s',color($minColor,$lmm),"",$minPlot); $out.= sprintf('%s',$xpos+3,color($nullColor,$lmm),"",0) if (defined $nullColor); - $out.=sprintf('%s',::strftime("%H:%M",localtime($time-$hours*3600))); - $out.=sprintf('%s',::strftime("%H:%M",localtime($time-$hours*1800))); - $out.=sprintf('%s',::strftime("%H:%M",localtime($time))); + $out.=sprintf('%s',::strftime("%H:%M",localtime($time-$hours*3600))); + $out.=sprintf('%s',::strftime("%H:%M",localtime($time-$hours*1800))); + $out.=sprintf('%s',::strftime("%H:%M",localtime($time))); $out.= ''; $out.= ''; $out.=''; @@ -4654,12 +4662,12 @@ sub card $out.=''; if (defined $maxVal) { - $out.= sprintf('▲%s',::strftime("%H:%M",localtime($maxValTime))); - $out.= sprintf('%s',color($maxValColor,$lmm),"",sprintf($format,$maxVal)); + $out.= sprintf('▲%s',::strftime("%H:%M",localtime($maxValTime))); + $out.= sprintf('%s',color($maxValColor,$lmm),"",sprintf($format,$maxVal)); } if (defined $minVal) { - $out.= sprintf('▼%s',::strftime("%H:%M",localtime($minValTime))); - $out.= sprintf('%s',color($minValColor,$lmm),"",sprintf($format,$minVal)); + $out.= sprintf('• ▼%s',::strftime("%H:%M",localtime($minValTime))); + $out.= sprintf('%s',color($minValColor,$lmm),"",sprintf($format,$minVal)); } $out.=''; $out.= '';