diff --git a/fhem/FHEM/98_DOIF.pm b/fhem/FHEM/98_DOIF.pm
index 7274a039c..6d113f3c1 100644
--- a/fhem/FHEM/98_DOIF.pm
+++ b/fhem/FHEM/98_DOIF.pm
@@ -1399,6 +1399,9 @@ sub collect_setValue
}
}
}
+ $hash->{collect}{"$name $reading"}{$hours}{max_value_plot}=(defined ${$va}[0] and ${$va}[0]>$maxVal) ? ${$va}[0]:$maxVal;
+ $hash->{collect}{"$name $reading"}{$hours}{min_value_plot}=(defined ${$va}[0] and ${$va}[0]<$minVal) ? ${$va}[0]:$minVal;
+
$hash->{collect}{"$name $reading"}{$hours}{max_value}=$maxVal;
$hash->{collect}{"$name $reading"}{$hours}{max_value_time}=$maxValTime;
$hash->{collect}{"$name $reading"}{$hours}{max_value_slot}=$maxValSlot;
@@ -4450,38 +4453,35 @@ sub get_color {
$color=(1-$prop)*($minColor-$maxColor)+$maxColor;
}
}
- return($color,$minColor,$maxColor);
+ return(int($color),$minColor,$maxColor);
}
sub card
{
my ($collect,$header,$icon,$min,$max,$minColor,$maxColor,$unit,$func,$decfont,$size,$model,$lightness) = @_;
-
- ##my ($collect,$icon,$header,$min$maxColor,$unit,$decfont,$light,$size)=@_;
my $val=${$collect}{value};
my $a=@{$collect}{values};
my $maxVal = ${$collect}{max_value};
+ my $maxValPlot = ${$collect}{max_value_plot};
my $maxValTime = ${$collect}{max_value_time};
my $maxValSlot = ${$collect}{max_value_slot};
-
my $minVal = ${$collect}{min_value};
+ my $minValPlot = ${$collect}{min_value_plot};
my $minValTime = ${$collect}{min_value_time};
my $minValSlot = ${$collect}{min_value_slot};
my $hours = ${$collect}{hours};
my $time = ${$collect}{time};
-
+ $maxValPlot=$val if (!defined $maxValPlot);
+ $minValPlot=$val if (!defined $minValPlot);
+
my $bwidth=160;
my $bheight=88;
my $htrans=0;
-
-
- my ($maxValColor)=get_color($maxVal,$min,$max,$minColor,$maxColor,$func);
- my ($minValColor)=get_color($minVal,$min,$max,$minColor,$maxColor,$func);
-
+
my $out;
- my $trans=0;
+ ## my $trans=0;
my ($ic,$iscale,$ix,$iy,$rotate);
- my $minCol=$minColor;
+ ##my $minCol=$minColor;
my ($dec,$fontformat,$unitformat);
($dec,$fontformat,$unitformat)=split (/,/,$decfont) if (defined $decfont);
@@ -4494,9 +4494,7 @@ sub card
my ($format,$value);
my ($lr,$lir,$lmm,$lu,$ln,$li);
-
($lr,$lir,$lmm,$lu,$ln,$li)=split (/,/,$lightness) if (defined $lightness);
-
$unit="" if (!defined $unit);
if (defined $header) {
@@ -4504,7 +4502,7 @@ sub card
$bheight += 28;
}
- my $height=$bheight;
+ ##my $height=$bheight;
$min=0 if (!defined $min);
$max=100 if (!defined $max);
@@ -4516,9 +4514,16 @@ sub card
$value=$min if ($value<$min);
$size=100 if (!defined $size);
+
+ my ($maxValColor)=get_color($maxVal,$min,$max,$minColor,$maxColor,$func);
+ my ($minValColor)=get_color($minVal,$min,$max,$minColor,$maxColor,$func);
+
+ my ($maxValPlotColor)=get_color($maxValPlot,$min,$max,$minColor,$maxColor,$func);
+ my ($minValPlotColor)=get_color($minValPlot,$min,$max,$minColor,$maxColor,$func);
+
my $currColor;
($currColor,$minColor,$maxColor)=get_color($value,$min,$max,$minColor,$maxColor,$func);
-
+
if (defined ($icon)) {
($ic,$iscale,$ix,$iy,$rotate)=split(",",$icon);
$rotate=0 if (!defined $rotate);
@@ -4532,27 +4537,62 @@ sub card
my ($m,$n)=m_n($min,0,$max,50);
my $xpos;
my $nullColor;
+ my $nullProp;
+ my $topVal;
+ my $topOpacity;
+ my $bottomVal;
+ my $bottomOpacity;
+ my $nullOpacity;
if ($min < 0 and $max > 0) {
$xpos=50-int($n*10)/10;
- ($nullColor,$minColor,$maxColor)=get_color(0,$min,$max,$minColor,$maxColor,$func);
+ $topVal=($maxValPlot > 0 ? $maxValPlot : 0);
+ $bottomVal=($minValPlot < 0 ? $minValPlot : 0);
+ ($nullColor)=get_color(0,$min,$max,$minColor,$maxColor,$func);
+ $nullProp=int ($maxValPlot/($maxValPlot-$minValPlot)*10)/10 if ($maxValPlot != $minValPlot);
+ $topOpacity=0.3;
+ $bottomOpacity=0.3;
+ $nullOpacity=0.05;
} elsif ($max <= 0) {
$xpos=0;
+ $topVal=$max;
+ $topOpacity=0.05;
+ $bottomOpacity=0.3;
+ $bottomVal=$minValPlot;
} else {
$xpos=50;
+ $topVal=$maxValPlot;
+ $topOpacity=0.3;
+ $bottomOpacity=0.05;
+ $bottomVal=$min;
}
+
$ic="$ic\@".color($currColor,$ln) if (defined($icon) and $icon !~ /@/);
+ my ($topValColor)=get_color($topVal,$min,$max,$minColor,$maxColor,$func);
+ my ($bottomValColor)=get_color($bottomVal,$min,$max,$minColor,$maxColor,$func);
+ my ($color75)=get_color((($topVal-$bottomVal)*0.75+$bottomVal),$min,$max,$minColor,$maxColor,$func);
+ my ($color50)=get_color((($topVal-$bottomVal)*0.5+$bottomVal),$min,$max,$minColor,$maxColor,$func);
+ my ($color25)=get_color((($topVal-$bottomVal)*0.25+$bottomVal),$min,$max,$minColor,$maxColor,$func);
+
$out.= sprintf ('';
- if (defined $header or !defined $icon) {
- $out.=''; #$out.='';
- $out.= ui_Table::ring($val,$min,$max,$minColor,$maxColor,$unit,100,$func,$decfont,$model,$lightness);
- } else {
- $out.='';# ''
- $out.= ui_Table::ring($val,$min,$max,$minColor,$maxColor,$unit,100,$func,$decfont,$model,$lightness,undef,$icon);
- }
+ $out.='';
+ $out.= ui_Table::ring($val,$min,$max,$minColor,$maxColor,$unit,100,$func,$decfont,$model,$lightness,undef,(defined $header or !defined $icon) ? undef: $icon);
$out.='';
if (defined $maxVal) {