2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 13:26:02 +00:00

SVG: fix X-Axis text for fixedrange&entPlotNow (Forum #25768)

git-svn-id: https://svn.fhem.de/fhem/trunk@6350 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-08-03 10:50:39 +00:00
parent c8f7b8e979
commit c9f32b5f87

View File

@ -978,7 +978,9 @@ SVG_render($$$$$$$$$)
return $SVG_RET if(!defined($dp)); return $SVG_RET if(!defined($dp));
my $nr_axis = AttrVal($parent_name,"nrAxis","1,1"); my $nr_axis = AttrVal($parent_name,"nrAxis","1,1");
my ($nr_left_axis,$nr_right_axis,$use_left_axis,$use_right_axis) = split(",", AttrVal($name,"nrAxis",$nr_axis)); my ($nr_left_axis,$nr_right_axis,$use_left_axis,$use_right_axis) =
split(",", AttrVal($name,"nrAxis",$nr_axis));
$use_left_axis = $nr_left_axis if( !defined($use_left_axis) ); $use_left_axis = $nr_left_axis if( !defined($use_left_axis) );
$use_right_axis = $nr_right_axis if( !defined($use_right_axis) ); $use_right_axis = $nr_right_axis if( !defined($use_right_axis) );
@ -993,7 +995,8 @@ SVG_render($$$$$$$$$)
my $ps = "800,400"; my $ps = "800,400";
$ps = $1 if($conf{terminal} =~ m/.*size[ ]*([^ ]*)/); $ps = $1 if($conf{terminal} =~ m/.*size[ ]*([^ ]*)/);
my ($ow,$oh) = split(",", $ps); # Original width my ($ow,$oh) = split(",", $ps); # Original width
my ($w, $h) = ($ow-$nr_left_axis*$axis_width-$nr_right_axis*$axis_width, $oh-2*$y); # Rect size my $w = $ow-$nr_left_axis*$axis_width-$nr_right_axis*$axis_width;
my $h = $oh-2*$y; # Rect size
# Keep only the Filter part of the #FileLog # Keep only the Filter part of the #FileLog
$flog = join(" ", map { my @a=split(":",$_); $flog = join(" ", map { my @a=split(":",$_);
@ -1040,10 +1043,12 @@ SVG_render($$$$$$$$$)
###################### ######################
# Copy and Paste labels, hidden by default # Copy and Paste labels, hidden by default
SVG_pO "<text id=\"svg_paste\" x=\"" . ($ow-$axis_width-$nr_right_axis*$axis_width) . "\" y=\"$off2\" " . SVG_pO "<text id=\"svg_paste\" x=\"" .
($ow-$axis_width-$nr_right_axis*$axis_width) . "\" y=\"$off2\" " .
"onclick=\"parent.svg_paste(evt)\" " . "onclick=\"parent.svg_paste(evt)\" " .
"class=\"paste\" text-anchor=\"end\"> </text>"; "class=\"paste\" text-anchor=\"end\"> </text>";
SVG_pO "<text id=\"svg_copy\" x=\"" . ($ow-$nr_right_axis*$axis_width) . "\" y=\"$off2\" " . SVG_pO "<text id=\"svg_copy\" x=\"" .
($ow-$nr_right_axis*$axis_width) . "\" y=\"$off2\" " .
"onclick=\"parent.svg_copy(evt)\" " . "onclick=\"parent.svg_copy(evt)\" " .
"class=\"copy\" text-anchor=\"end\"> </text>"; "class=\"copy\" text-anchor=\"end\"> </text>";
@ -1203,6 +1208,11 @@ SVG_render($$$$$$$$$)
my $t = SVG_fmtTime($first_tag, $fromsec); my $t = SVG_fmtTime($first_tag, $fromsec);
SVG_pO "<text x=\"0\" y=\"$off2\" class=\"ylabel\">$t</text>"; SVG_pO "<text x=\"0\" y=\"$off2\" class=\"ylabel\">$t</text>";
$initoffset = $step; $initoffset = $step;
if(AttrVal($FW_wname, "endPlotNow", undef) && $ddur>1.1 && $ddur<7.1) {
$initoffset -= (86400-time()%86400); # Forum #25768
}
$initoffset = int(($step/2)/86400)*86400 if($aligntext); $initoffset = int(($step/2)/86400)*86400 if($aligntext);
for(my $i = $fromsec+$initoffset; $i < $tosec; $i += $step) { for(my $i = $fromsec+$initoffset; $i < $tosec; $i += $step) {
$i = SVG_time_align($i,$aligntext); $i = SVG_time_align($i,$aligntext);