diff --git a/fhem/FHEM/98_DOIF.pm b/fhem/FHEM/98_DOIF.pm
index c63a6919e..808064553 100644
--- a/fhem/FHEM/98_DOIF.pm
+++ b/fhem/FHEM/98_DOIF.pm
@@ -4860,8 +4860,9 @@ sub ring2
sub y_h
{
- my ($value,$min,$max,$height) = @_;
-
+ my ($value,$min,$max,$height,$mode) = @_;
+ my $offset=4.5;
+ $offset=0 if (defined $mode);
if ($value > $max) {
$value=$max;
} elsif ($value < $min) {
@@ -4879,7 +4880,7 @@ sub y_h
}
my $prop=$value/($max-$min);
- my $h=int(abs($prop*($height))+4.5);
+ my $h=int(abs($prop*($height))+$offset);
my $y;
my $null;
@@ -4887,7 +4888,7 @@ sub y_h
if ($value <= 0) {
$y=$null;
} else {
- $y=int($null+4.5-$h);
+ $y=int($null+$offset-$h);
}
$null=undef if ($max == 0 or $min == 0);
return ($y,$h,$null);
@@ -4906,10 +4907,19 @@ sub hsl_color
return("hsl($hue,$sat%,$light%)");
}
-
-sub cylinder
-{
+sub cylinder_bars {
my ($header,$min,$max,$unit,$bwidth,$height,$size,$dec,@values) = @_;
+ return(cylinder_mode ($header,$min,$max,$unit,$bwidth,$height,$size,$dec,1,@values));
+}
+
+sub cylinder {
+ my ($header,$min,$max,$unit,$bwidth,$height,$size,$dec,@values) = @_;
+ return(cylinder_mode ($header,$min,$max,$unit,$bwidth,$height,$size,$dec,undef,@values));
+}
+
+sub cylinder_mode
+{
+ my ($header,$min,$max,$unit,$bwidth,$height,$size,$dec,$mode,@values) = @_;
my $out;
my $ybegin;
@@ -4931,13 +4941,23 @@ sub cylinder
$bheight=$height-10;
}
my $width=30;
+ my $heightoffset=4;
+
+ if (defined $mode) {
+ $width=7;
+ }
+
if (!defined $bwidth or $bwidth eq "") {
my $lenmax=0;
for (my $i=0;$i<@values;$i+=3){
$values[$i+2]="" if (!defined $values[$i+2]);
$lenmax=length($values[$i+2]) if (length($values[$i+2]) > $lenmax);
}
- $bwidth=90+$lenmax*4.3;
+ if (defined $mode) {
+ $bwidth=@values/3*($width+2)+60+$lenmax*4.3;
+ } else {
+ $bwidth=90+$lenmax*4.3;
+ }
}
my ($y,$val1,$null);
@@ -4948,38 +4968,44 @@ sub cylinder
$out.= '';
for (my $i=0;$i<@values;$i+=3){
my $color=$values[$i+1];
- $out.= sprintf('',$color,hsl_color($color),hsl_color($color));
+ $out.= sprintf('',$color,hsl_color($color),hsl_color($color));
}
$out.= '';
+ $out.= '';
+
$out.= '';
$out.= sprintf('',$bwidth-2, $bheight+40);
$out.= sprintf('%s',$bwidth/2+11,$header) if ($header ne "");
$out.= sprintf('',$trans);
-
- $out.= sprintf('',$width,$height+4);
- $out.= sprintf('',$height,$width);
-
- $out.= sprintf('',$width);
- ##$out.= sprintf('',$width,$height+4);
-
- ##$out.= sprintf('',$height,$width);
- # $out.= sprintf('',$null,$width) if (defined $null);
-
-
- $out.= sprintf('',$width);
+ if (defined $mode) {
+ $out.= sprintf('',!defined $mode ? $width:@values/3*($width+2)+2,$height+$heightoffset+2);
+ } else {
+ $out.= sprintf('',!defined $mode ? $width:@values/3*($width+2)+2,$height+$heightoffset);
+ $out.= sprintf('',$height,$width);
+ $out.= sprintf('',$width);
+ }
($y,$val1,$null)=y_h(0,$min,$max,$height);
- $out.= sprintf('%s',$height+5,$min);
- $out.= sprintf('%s',$null+6,0) if (defined $null);
- $out.= sprintf('%s',6,$max);
+ my $xLeft=15;
+ my $xBegin=$xLeft+33;
+ $xBegin=@values/3*($width+2)+20 if(defined $mode);
+
+ $out.= sprintf('%s',$xBegin,$height+$heightoffset+1,$min);
+ $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 $xValue=$xLeft;
+
for (my $i=0;$i<@values;$i+=3){
my $yValue=$yBegin+9;
my $value=$values[$i];
my $val=$value;
+ if (defined $mode) {
+ $xValue=$xLeft+$i/3*($width+2)+2 if (defined $mode);
+ }
if (!defined $value or $value eq "") {
$val="N/A";
$value=0;
@@ -4987,20 +5013,22 @@ sub cylinder
my $color=$values[$i+1];
my $text=$values[$i+2];
- ($y,$val1,$null)=y_h($value,$min,$max,$height);
- $out.= sprintf('',$y,$width);#,hsl_color($color,0));
- $out.= sprintf('',$y,$width,$val1,$color);
- #$out.= sprintf('',$y,$width);
-
+ ($y,$val1,$null)=y_h($value,$min,$max,$height,$mode);
+ if (!defined $mode) {
+ $out.= sprintf('',$xValue,$y,$width,$val1,$color);
+ $out.= sprintf('',$xValue,$y,$width,$color);#,hsl_color($color,0));
+ ## $out.= sprintf('',$xValue,$y,$width,$val1,$color);
+ } else {
+ $out.= sprintf('',$xValue,$y+2,$width,$val1+2,$color);
+ }
if (defined $text and $text ne "") {
- $out.= sprintf('%s',$yBegin+$i*10,hsl_color($color),$text.":");
+ $out.= sprintf('%s',$xBegin+10,$yBegin+$i*10,hsl_color($color),$text.":");
$yValue+=7;
}
$out.= sprintf('%s%s',$bwidth+5, $yValue+$i*10,hsl_color ($color),($val eq "N/A" ? $val:sprintf($format,$val)),$unit);
}
- ##$out.= sprintf('',$width);
$out.= '';
$out.= '';
return ($out);