2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 10:46:53 +00:00

Hour resolution by Florian

git-svn-id: https://svn.fhem.de/fhem/trunk@2756 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-02-18 08:21:36 +00:00
parent 6db3002175
commit 189ffe035f
3 changed files with 23 additions and 6 deletions

View File

@ -76,6 +76,7 @@
- bugfix: floorplan-correction for readings with longpoll. Requires local - bugfix: floorplan-correction for readings with longpoll. Requires local
change in css! change in css!
- feature: floorplan added js-extension from Dirk - feature: floorplan added js-extension from Dirk
- feature: hour resolution in SVG
- 2012-10-28 (5.3) - 2012-10-28 (5.3)
- feature: added functions trim, ltrim, rtrim, UntoggleDirect, - feature: added functions trim, ltrim, rtrim, UntoggleDirect,

View File

@ -94,7 +94,7 @@ my $FW_RETTYPE; # image/png or the like
my $FW_room; # currently selected room my $FW_room; # currently selected room
my %FW_rooms; # hash of all rooms my %FW_rooms; # hash of all rooms
my %FW_types; # device types, for sorting my %FW_types; # device types, for sorting
my @FW_zoom; # "qday", "day","week","month","year" my @FW_zoom; # "hour","qday","day","week","month","year"
my %FW_zoom; # the same as @FW_zoom my %FW_zoom; # the same as @FW_zoom
my %FW_hiddenroom; # hash of hidden rooms my %FW_hiddenroom; # hash of hidden rooms
my %FW_hiddengroup;# hash of hidden groups my %FW_hiddengroup;# hash of hidden groups
@ -133,7 +133,7 @@ FHEMWEB_Initialize($)
############### ###############
# Initialize internal structures # Initialize internal structures
my $n = 0; my $n = 0;
@FW_zoom = ("qday", "day","week","month","year"); @FW_zoom = ("hour","qday", "day","week","month","year");
%FW_zoom = map { $_, $n++ } @FW_zoom; %FW_zoom = map { $_, $n++ } @FW_zoom;
addToAttrList("webCmd"); addToAttrList("webCmd");
@ -1747,8 +1747,11 @@ FW_zoomLink($$$)
# Approximation of the next offset. # Approximation of the next offset.
my $w_off = $FW_pos{off}; my $w_off = $FW_pos{off};
$w_off = 0 if(!$w_off); $w_off = 0 if(!$w_off);
if($val eq "qday") {
$w_off = $w_off*4; if ($val eq "hour") {
$w_off = $w_off*6;
} elsif($val eq "qday") {
$w_off = ($off < 0) ? $w_off*4 : int($w_off/6);
} elsif($val eq "day") { } elsif($val eq "day") {
$w_off = ($off < 0) ? $w_off*7 : int($w_off/4); $w_off = ($off < 0) ? $w_off*7 : int($w_off/4);
} elsif($val eq "week") { } elsif($val eq "week") {
@ -1813,7 +1816,17 @@ FW_calcWeblink($$)
$zoom = "day" if(!$zoom); $zoom = "day" if(!$zoom);
$zoom = $frx if ($frx); #for fixedrange {day|week|...} klaus $zoom = $frx if ($frx); #for fixedrange {day|week|...} klaus
if($zoom eq "qday") {
if($zoom eq "hour") {
my $t = $now + $off*3600;
my @l = localtime($t);
$FW_devs{$d}{from}
=sprintf("%04d-%02d-%02d_%02d",$l[5]+1900,$l[4]+1,$l[3],$l[2]);
$FW_devs{$d}{to}
=sprintf("%04d-%02d-%02d_%02d",$l[5]+1900,$l[4]+1,$l[3],$l[2]+1);;
} elsif($zoom eq "qday") {
my $t = $now + $off*21600; my $t = $now + $off*21600;
my @l = localtime($t); my @l = localtime($t);

View File

@ -244,7 +244,10 @@ SVG_render($$$$$$$$)
# Compute & draw vertical tics, grid and labels # Compute & draw vertical tics, grid and labels
my $ddur = ($tosec-$fromsec)/86400; my $ddur = ($tosec-$fromsec)/86400;
my ($first_tag, $tag, $step, $tstep, $aligntext, $aligntics); my ($first_tag, $tag, $step, $tstep, $aligntext, $aligntics);
if($ddur <= 0.5) {
if ($ddur <= 0.1) {
$first_tag=". 2 1"; $tag=": 3 4"; $step = 300; $tstep = 60;
} elsif($ddur <= 0.5) {
$first_tag=". 2 1"; $tag=": 3 4"; $step = 3600; $tstep = 900; $first_tag=". 2 1"; $tag=": 3 4"; $step = 3600; $tstep = 900;
} elsif($ddur <= 1.1) { # +0.1 -> DST } elsif($ddur <= 1.1) { # +0.1 -> DST
$first_tag=". 2 1"; $tag=": 3 4"; $step = 4*3600; $tstep = 3600; $first_tag=". 2 1"; $tag=": 3 4"; $step = 4*3600; $tstep = 3600;