Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.

Tue, 21 Jul 2015 21:20:57 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 21 Jul 2015 21:20:57 +0200
changeset 384
5db8186fe803
parent 383
ad6edfde6189
child 385
260e92f0f998

Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.

www-thermferm/archives.php file | annotate | diff | comparison | revisions
www-thermferm/liveview.php file | annotate | diff | comparison | revisions
--- a/www-thermferm/archives.php	Sat Jun 27 17:28:16 2015 +0200
+++ b/www-thermferm/archives.php	Tue Jul 21 21:20:57 2015 +0200
@@ -142,6 +142,15 @@
     $outstr .= '           {'.PHP_EOL;
     $outstr .= '             dataField: \'Date\','.PHP_EOL;
     $outstr .= '             type: \'date\','.PHP_EOL;
+    $outstr .= '             formatFunction: function (value) {'.PHP_EOL;
+    $outstr .= '                return value.getDate() + \'-\' + value.getMonth() + \'-\' + value.getFullYear()'.PHP_EOL;
+    $outstr .= '             },'.PHP_EOL;
+    $outstr .= '             toolTipFormatFunction: function (value) {'.PHP_EOL;
+    $outstr .= '                var h = value.getHours();'.PHP_EOL;
+    $outstr .= '                var m = value.getMinutes();'.PHP_EOL;
+    $outstr .= '                return value.getDate() + \'-\' + value.getMonth() + \'-\' + value.getFullYear()'; 
+    $outstr .= ' + \' \' + (h < 10 ? \'0\' + h : h) + \':\' + (m < 10 ? \'0\' + m : m);'.PHP_EOL;
+    $outstr .= '             },'.PHP_EOL;
     $outstr .= '             textRotationAngle: 45,'.PHP_EOL;
     $outstr .= '             showGridLines: false'.PHP_EOL;
     $outstr .= '           },'.PHP_EOL;
--- a/www-thermferm/liveview.php	Sat Jun 27 17:28:16 2015 +0200
+++ b/www-thermferm/liveview.php	Tue Jul 21 21:20:57 2015 +0200
@@ -143,6 +143,15 @@
 	$outstr .= '           {'.PHP_EOL;
 	$outstr .= '             dataField: \'Date\','.PHP_EOL;
 	$outstr .= '             type: \'date\','.PHP_EOL;
+	$outstr .= '             formatFunction: function (value) {'.PHP_EOL;
+	$outstr .= '                return value.getDate() + \'-\' + value.getMonth() + \'-\' + value.getFullYear()'.PHP_EOL;
+	$outstr .= '             },'.PHP_EOL;
+	$outstr .= '             toolTipFormatFunction: function (value) {'.PHP_EOL;
+	$outstr .= '                var h = value.getHours();'.PHP_EOL;
+	$outstr .= '                var m = value.getMinutes();'.PHP_EOL;
+	$outstr .= '                return value.getDate() + \'-\' + value.getMonth() + \'-\' + value.getFullYear()';
+	$outstr .= ' + \' \' + (h < 10 ? \'0\' + h : h) + \':\' + (m < 10 ? \'0\' + m : m);'.PHP_EOL;
+	$outstr .= '             },'.PHP_EOL;
 	$outstr .= '             textRotationAngle: 45,'.PHP_EOL;
 	$outstr .= '             showGridLines: false'.PHP_EOL;
 	$outstr .= '           },'.PHP_EOL;

mercurial