From 3944f351d5113b8937062f7b47553dcfa582d156 Mon Sep 17 00:00:00 2001
From: rudolfkoenig <>
Date: Mon, 29 Apr 2013 14:02:23 +0000
Subject: [PATCH] .gplot editor fixes after more tests

git-svn-id: https://svn.fhem.de/fhem/trunk@3131 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
 fhem/FHEM/01_FHEMWEB.pm       |  5 ++++-
 fhem/FHEM/98_weblink.pm       | 11 +++++++++--
 fhem/www/gplot/template.gplot | 10 ++++------
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm
index d4d4949e9..46922c325 100755
--- a/fhem/FHEM/01_FHEMWEB.pm
+++ b/fhem/FHEM/01_FHEMWEB.pm
@@ -454,7 +454,10 @@ FW_answerCall($)
       #Returns undef if it already sent a HTTP header
       ($FW_RETTYPE, $FW_RET) = &{$h->{FUNC}}($arg);
       use strict "refs";
-      last if(!$FW_RET);
+      if(!$FW_RET) {
+        $FW_RETTYPE = "text/html; charset=$FW_encoding";
+        last;
+      }
       return defined($FW_RETTYPE) ? 0 : -1;
     }
   }
diff --git a/fhem/FHEM/98_weblink.pm b/fhem/FHEM/98_weblink.pm
index bbef51018..4590cda13 100755
--- a/fhem/FHEM/98_weblink.pm
+++ b/fhem/FHEM/98_weblink.pm
@@ -295,9 +295,10 @@ wl_PEdit($$$$)
   $ret .=" <td>Y-Axis,Plot-Type,Style</td></tr>";
 
   my ($colnums, $colregs, $coldata) = wl_getRegFromFile($file);
-  $colnums = join(",", 3..$colnums);
+  $colnums = join(",", 4..$colnums);
   my $max = @{$conf{lAxis}}+1;
   $max = 7 if($max > 7);
+  $max = 1 if(!$conf{lTitle}[0]);
   my $r = 0;
   for($r=0; $r < $max; $r++) {
     $ret .= "<tr class=\"".(($r&1)?"odd":"even")."\"><td>";
@@ -339,6 +340,12 @@ weblink_WriteGplot($)
   my ($arg) = @_;
   FW_digestCgi($arg);
 
+  my $hasTl;
+  for(my $i=0; $i <= 8; $i++) {
+    $hasTl = 1 if($FW_webArgs{"title_$i"});
+  }
+  return if(!$hasTl);
+
   my $fName = $FW_webArgs{gplotName};
   return if(!$fName);
   if(!open(FH, ">$fName")) {
@@ -351,7 +358,7 @@ weblink_WriteGplot($)
   print FH "set xdata time\n";
   print FH "set timefmt \"%Y-%m-%d_%H:%M:%S\"\n";
   print FH "set xlabel \" \"\n";
-  print FH "set title '<L1>'\n";
+  print FH "set title '<TL>'\n";
   print FH "set ytics ".$FW_webArgs{ytics}."\n";
   print FH "set y2tics ".$FW_webArgs{y2tics}."\n";
   print FH "set grid".($FW_webArgs{gridy}  ? " ytics" :"").
diff --git a/fhem/www/gplot/template.gplot b/fhem/www/gplot/template.gplot
index f98816ab3..c03fbe4f7 100644
--- a/fhem/www/gplot/template.gplot
+++ b/fhem/www/gplot/template.gplot
@@ -10,14 +10,12 @@ set timefmt "%Y-%m-%d_%H:%M:%S"
 set xlabel " "
 
 set title '<TL>'
-set ylabel "Power (KW)"
-set y2label "Power (KW)"
+set ylabel "Humidity"
+set y2label "Temperature"
 set grid
 set ytics
 set y2tics
-set format y "%.1f"
-set format y2 "%.1f"
 
-#FileLog 4::0:
+#FileLog 4:RegExp::
 
-plot "<IN>" using 1:4 notitle with lines
+plot "<IN>" using 1:2 title 'Line 1' with lines