mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
98_DOIF.pm: svg card: default lightgray, negative/positive area is hidden
git-svn-id: https://svn.fhem.de/fhem/trunk@24236 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0fa5c31dd8
commit
af9601652b
@ -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('<rect x="11" y="0" width="%d" height="%d" rx="2" ry="2" fill="url(#gradcardback)"/>',$bwidth-2,$bheight);
|
||||
|
||||
if (defined $header) {
|
||||
$out.= sprintf('<text text-anchor="start" x="14" y="23" style="fill:white; font-size:14px;%s">%s</text>',$header_style,$header_txt);
|
||||
$out.= sprintf('<text text-anchor="start" x="14" y="23" style="fill:lightgray; font-size:14px;%s">%s</text>',$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.='<polyline points="11,27 169,27" style="stroke:gray; stroke-width:1" />';
|
||||
}
|
||||
$out.= sprintf('<g transform="translate(0,%d)">',$htrans);
|
||||
$out.= sprintf('<g transform="translate(0,%d)" style="fill:lightgray">',$htrans);
|
||||
$out.='<polyline points="11,73 169,73" style="stroke:gray; stroke-width:1" />';
|
||||
$out.= '<svg width="102" height="72">';
|
||||
$out.= '<g transform="translate(32,8) scale(1) ">';
|
||||
$out.= '<g transform="translate(32,8)" style="fill:lightgray">';
|
||||
my $points="";
|
||||
my $first=1;
|
||||
|
||||
@ -4639,14 +4647,14 @@ sub card
|
||||
$out.=sprintf('<circle cx="%s" cy="%s" r="2" fill="%s" opacity="0.7"/>,',$minValSlot,(50-int((${$a}[$minValSlot]*$m+$n)*10)/10),color($minValColor,$ln)) if (defined $minVal and $minValSlot != 59);
|
||||
$out.=sprintf('<circle cx="59" cy="%s" r="2" fill="%s" opacity="0.7"> <animate attributeName="opacity" values="0.2;1;0.2" dur="2s" repeatCount="indefinite"/></circle>',(50-int(($val*$m+$n)*10)/10),color($currColor,$ln));
|
||||
|
||||
$out.= sprintf('<text text-anchor="end" x="-2" y="3" style="fill:%s;font-size:8px;%s">%s</text>',color($maxColor,$lmm),"",$max);
|
||||
$out.= sprintf('<text text-anchor="end" x="-2" y="53" style="fill:%s;font-size:8px;%s">%s</text>',color($minColor,$lmm),"",$min);
|
||||
$out.= sprintf('<text text-anchor="end" x="-2" y="3" style="fill:%s;font-size:8px;%s">%s</text>',color($maxColor,$lmm),"",$maxPlot);
|
||||
$out.= sprintf('<text text-anchor="end" x="-2" y="53" style="fill:%s;font-size:8px;%s">%s</text>',color($minColor,$lmm),"",$minPlot);
|
||||
$out.= sprintf('<text text-anchor="end" x="-2" y="%s" style="fill:%s;font-size:8px;%s">%s</text>',$xpos+3,color($nullColor,$lmm),"",0) if (defined $nullColor);
|
||||
|
||||
|
||||
$out.=sprintf('<text text-anchor="middle" x="0" y="61" style="fill:white; font-size:8px">%s</text>',::strftime("%H:%M",localtime($time-$hours*3600)));
|
||||
$out.=sprintf('<text text-anchor="middle" x="29" y="61" style="fill:white; font-size:8px">%s</text>',::strftime("%H:%M",localtime($time-$hours*1800)));
|
||||
$out.=sprintf('<text text-anchor="end" x="69" y="61" style="fill:white; font-size:8px">%s</text>',::strftime("%H:%M",localtime($time)));
|
||||
$out.=sprintf('<text text-anchor="middle" x="0" y="61" style="font-size:8px">%s</text>',::strftime("%H:%M",localtime($time-$hours*3600)));
|
||||
$out.=sprintf('<text text-anchor="middle" x="29" y="61" style="font-size:8px">%s</text>',::strftime("%H:%M",localtime($time-$hours*1800)));
|
||||
$out.=sprintf('<text text-anchor="end" x="69" y="61" style="font-size:8px">%s</text>',::strftime("%H:%M",localtime($time)));
|
||||
$out.= '</g>';
|
||||
$out.= '</svg>';
|
||||
$out.='<g transform="translate(105,4)">';
|
||||
@ -4654,12 +4662,12 @@ sub card
|
||||
|
||||
$out.='</g>';
|
||||
if (defined $maxVal) {
|
||||
$out.= sprintf('<text text-anchor="start" x="13" y="85" style="fill:white; font-size:10px">▲%s</text>',::strftime("%H:%M",localtime($maxValTime)));
|
||||
$out.= sprintf('<text text-anchor="end" x="89" y="85" style="fill:%s;font-size:10px;%s">%s</text>',color($maxValColor,$lmm),"",sprintf($format,$maxVal));
|
||||
$out.= sprintf('<text text-anchor="start" x="13" y="85" style="font-size:10px">▲%s</text>',::strftime("%H:%M",localtime($maxValTime)));
|
||||
$out.= sprintf('<text text-anchor="end" x="85" y="85" style="fill:%s;font-size:10px;%s">%s</text>',color($maxValColor,$lmm),"",sprintf($format,$maxVal));
|
||||
}
|
||||
if (defined $minVal) {
|
||||
$out.= sprintf('<text text-anchor="start" x="91" y="85" style="fill:white; font-size:10px">▼%s</text>',::strftime("%H:%M",localtime($minValTime)));
|
||||
$out.= sprintf('<text text-anchor="end" x="166" y="85" style="fill:%s;font-size:10px;%s">%s</text>',color($minValColor,$lmm),"",sprintf($format,$minVal));
|
||||
$out.= sprintf('<text text-anchor="start" x="89" y="85" style="font-size:10px">• ▼%s</text>',::strftime("%H:%M",localtime($minValTime)));
|
||||
$out.= sprintf('<text text-anchor="end" x="165" y="85" style="fill:%s;font-size:10px;%s">%s</text>',color($minValColor,$lmm),"",sprintf($format,$minVal));
|
||||
}
|
||||
$out.='</g>';
|
||||
$out.= '</svg>';
|
||||
|
Loading…
Reference in New Issue
Block a user