From eb8e50d726252ff827937a90f77e89692d9368db Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Wed, 10 Jun 2015 09:17:44 +0000 Subject: [PATCH] 98_logProxy.pm: added logProxy_values2Plot git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@8724 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/98_logProxy.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/FHEM/98_logProxy.pm b/FHEM/98_logProxy.pm index 8884f4753..af743cfbc 100644 --- a/FHEM/98_logProxy.pm +++ b/FHEM/98_logProxy.pm @@ -655,7 +655,25 @@ logProxy_xy2Plot($) return ($ret,$min,$max,$last); } +#create plot data from date-y-array +sub +logProxy_values2Plot($) +{ + my ($array) = @_; + my $ret = ";c 0\n"; + my $min = 999999; + my $max = -999999; + my $last; + + return ($ret,$min,$max,$last) if( !ref($array) eq "ARRAY" ); + + foreach my $point ( @{$array} ) { + $ret .= "$point->[0] $point->[1]\n"; + } + + return ($ret,$min,$max,$last); +} sub logProxy_Get($@) { @@ -1282,6 +1300,8 @@ logProxy_Get($@) the following list: hour,qday,day,week,month,year and the values representing the step with for the zoom level.
  • logProxy_xy2Plot(\@xyArray) is a sample implementation of a function that will accept a ref to an array of xy-cordinate pairs as the data to be plotted.
  • +
  • logProxy_values2Plot(\@xyArray) is a sample implementation of a function that will accept a ref to an array + of date-y-cordinate pairs as the data to be plotted.
  • The perl expressions have access to $from and $to for the begining and end of the plot range and also to the SVG specials min, max, avg, cnt, sum, currval (last value) and currdate (last date) values of the individual curves already plotted are available as $data{<special-n>}.