changeset 374:f0a61b700d23

merge
author Matt Johnston <matt@ucc.asn.au>
date Tue, 26 Jun 2012 23:49:31 +0800
parents dae8eb26eaa3 (current diff) 1f530c97c053 (diff)
children 41c3d817878d
files
diffstat 2 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/web/config.py	Tue Jun 26 21:46:08 2012 +0800
+++ b/web/config.py	Tue Jun 26 23:49:31 2012 +0800
@@ -21,4 +21,5 @@
                 }
 
 
-GRAPH_FONT = "URW Gothic L"
+GRAPH_FONT = "Prociono"
+#GRAPH_FONT = "URW Gothic L"
--- a/web/log.py	Tue Jun 26 21:46:08 2012 +0800
+++ b/web/log.py	Tue Jun 26 23:49:31 2012 +0800
@@ -10,6 +10,7 @@
 import syslog
 import sqlite3
 import traceback
+import datetime
 from colorsys import hls_to_rgb
 
 import config
@@ -71,9 +72,20 @@
         colour = config.SENSOR_COLOURS.get(legend, colour_from_string(sensor))
         graph_args.append('LINE%(width)f:%(vname)s#%(colour)s:%(legend)s' % locals())
 
+    end = int(start+length)
+    start = int(start)
+
     tempf = tempfile.NamedTemporaryFile()
-    args = [tempf.name, '-s', str(int(start)),
-        '-e', str(int(start+length)),
+    dateformat = '%H:%M:%S %Y-%m-%d'
+    watermark = ("Now %s\t"
+                "Start %s\t"
+                "End %s" % (
+                datetime.datetime.now().strftime(dateformat),
+                datetime.datetime.fromtimestamp(start).strftime(dateformat),
+                datetime.datetime.fromtimestamp(end).strftime(dateformat) ))
+
+    args = [tempf.name, '-s', str(start),
+        '-e', str(end),
         '-w', str(config.GRAPH_WIDTH),
         '-h', str(config.GRAPH_HEIGHT),
         '--slope-mode',
@@ -84,11 +96,13 @@
         '--color', 'GRID#00000000',
         '--color', 'MGRID#aaaaaa',
         '--color', 'BACK#ffffff',
+        '--disable-rrdtool-tag',
         'VRULE:%d#ee0000' % time.time(),
+        '--watermark', watermark,
         '--imgformat', 'PNG'] \
         + graph_args
-    args += ['--font', 'DEFAULT:11:%s' % config.GRAPH_FONT]
-    args += ['--font', 'WATERMARK:6:%s' % config.GRAPH_FONT]
+    args += ['--font', 'DEFAULT:12:%s' % config.GRAPH_FONT]
+    args += ['--font', 'WATERMARK:10:%s' % config.GRAPH_FONT]
     if have_volts:
         args += ['--right-axis', '0.1:2', # matches the scalevolts CDEF above
             '--right-axis-format', '%.2lf',