diff --git a/fhem/FHEM/98_DOIF.pm b/fhem/FHEM/98_DOIF.pm index 061d62c97..a5d28bdee 100644 --- a/fhem/FHEM/98_DOIF.pm +++ b/fhem/FHEM/98_DOIF.pm @@ -4573,7 +4573,7 @@ sub footer { sub plot { - my ($collect,$min_a,$max_a,$minColor,$maxColor,$dec,$func,$steps,$x_prop,$chart_dim,$noColor,$lmm,$ln,$lr,$plot,$bwidth,$footerPos,$fill,$pos,$anchor,$unitColor)=@_; + my ($collect,$min_a,$max_a,$minColor,$maxColor,$dec,$func,$steps,$x_prop,$chart_dim,$noColor,$lmm,$ln,$lr,$plot,$bwidth,$footerPos,$fill,$pos,$anchor,$unitColor,$unit)=@_; my $points=""; my $v; @@ -4590,6 +4590,7 @@ sub plot { my $minPlot; my $maxPlot; my $scaling=0; + $unit="" if (!defined $unit); my $val=${$collect}{value}; my $a=@{$collect}{values}; @@ -4775,22 +4776,23 @@ sub plot { if ($footerPos) { if (defined $maxValTime) { + $footer.= sprintf('%s',$footerPos,defined $unitColor ? $unitColor : "#CCCCCC", $unit); if ($hours > 168) { - $footer.= sprintf('%s',$footerPos,defined $unitColor ? $unitColor : "#CCCCCC", ::strftime("%d.%m %H:%M",localtime($maxValTime))); + $footer.= sprintf('%s',$footerPos,defined $unitColor ? $unitColor : "#CCCCCC", ::strftime("%d.%m %H:%M",localtime($maxValTime))); } else { - $footer.= sprintf('%s',$footerPos,defined $unitColor ? $unitColor : "#CCCCCC", ::strftime("%a",localtime($maxValTime))); - $footer.= sprintf('%s',$footerPos,::strftime("%H:%M",localtime($maxValTime))); + $footer.= sprintf('%s',$footerPos,defined $unitColor ? $unitColor : "#CCCCCC", ::strftime("%a",localtime($maxValTime))); + $footer.= sprintf('%s',$footerPos,::strftime("%H:%M",localtime($maxValTime))); } - $footer.= sprintf('%s',$bwidth/2+7,$footerPos,color($maxValColor,$lmm),"",sprintf($format,${$collect}{max_value})); + $footer.= sprintf('%s',$bwidth/2+22.5,$footerPos,color($maxValColor,$lmm),"",sprintf($format,${$collect}{max_value})); } if (defined $minValTime) { if ($hours > 168) { - $footer.= sprintf('%s',$bwidth/2+9,$footerPos,defined $unitColor ? $unitColor : "#CCCCCC", ::strftime("%d.%m %H:%M",localtime($minValTime))); + $footer.= sprintf('%s',$bwidth/2+23,$footerPos,defined $unitColor ? $unitColor : "#CCCCCC", ::strftime("%d.%m %H:%M",localtime($minValTime))); } else { - $footer.= sprintf('%s',$bwidth/2+9,$footerPos,defined $unitColor ? $unitColor : "#CCCCCC", ::strftime("%a",localtime($minValTime))); - $footer.= sprintf('%s',$bwidth/2+35,$footerPos,::strftime("%H:%M",localtime($minValTime))); + $footer.= sprintf('%s',$bwidth/2+23,$footerPos,defined $unitColor ? $unitColor : "#CCCCCC", ::strftime("%a",localtime($minValTime))); + $footer.= sprintf('%s',$bwidth/2+47,$footerPos,::strftime("%H:%M",localtime($minValTime))); } - $footer.= sprintf('%s', $bwidth+7,$footerPos,color($minValColor,$lmm),"",sprintf($format,${$collect}{min_value})); + $footer.= sprintf('%s', $bwidth+8,$footerPos,color($minValColor,$lmm),"",sprintf($format,${$collect}{min_value})); } } @@ -5058,17 +5060,17 @@ sub card $maxVal=$max if (!defined $maxVal or $max > $maxVal); } for (my $i=0;$i<@{$col};$i++) { - ($outplot,$outfooter) = plot (${$col}[$i],[$min,$minVal],[$max,$maxVal],$minColor,$maxColor,$dec,$func,$steps,$x_prop,$chart_dim, $i ? $noColor:-1,$lmm,$ln,$lr,$plot,$bwidth,$noFooter eq "1" ? 0:84+$i*10,undef,-2.5,"end",(split(",",${$unit_a}[$i]))[1]); + ($outplot,$outfooter) = plot (${$col}[$i],[$min,$minVal],[$max,$maxVal],$minColor,$maxColor,$dec,$func,$steps,$x_prop,$chart_dim, $i ? $noColor:-1,$lmm,$ln,$lr,$plot,$bwidth,$noFooter eq "1" ? 0:84+$i*10,undef,-2.5,"end",(split(",",${$unit_a}[$i]))[1],(split(",",${$unit_a}[$i]))[0]); $out.=$outplot; push (@outfooter,$outfooter); } } else { - my ($outplot,$outfooter) = plot ($collect,$min,$max,$minColor,$maxColor,$dec,$func,$steps,$x_prop,$chart_dim,$noColor,$lmm,$ln,$lr,$plot,$bwidth,$noFooter eq "1" ? 0:84,undef,-2.5,"end"); + my ($outplot,$outfooter) = plot ($collect,$min,$max,$minColor,$maxColor,$dec,$func,$steps,$x_prop,$chart_dim,$noColor,$lmm,$ln,$lr,$plot,$bwidth,$noFooter eq "1" ? 0:84,undef,-2.5,"end",undef,$unit); $out.=$outplot; push (@outfooter,$outfooter); } if (defined $collect2) { - ($outplot,$outfooter) = plot ($collect2,$min2,$max2,$minColor2,$maxColor2,$dec2,$func2,$steps,$x_prop,$chart_dim,$noColor,$lmm,$ln,$lr,$plot,$bwidth,$noFooter eq "1" ? 0:84+@outfooter*10,undef,$chart_dim+3,"start"); + ($outplot,$outfooter) = plot ($collect2,$min2,$max2,$minColor2,$maxColor2,$dec2,$func2,$steps,$x_prop,$chart_dim,$noColor,$lmm,$ln,$lr,$plot,$bwidth,$noFooter eq "1" ? 0:84+@outfooter*10,undef,$chart_dim+3,"start",undef,$unit2); $out.=$outplot; push (@outfooter,$outfooter) }