Mercurial > templog
changeset 384:abe8c530812e
ui tweaks
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 07 Jul 2012 23:32:02 +0800 |
parents | a032051475fe |
children | a827f1c5ddbe |
files | web/config.py web/log.py web/views/top.tpl |
diffstat | 3 files changed, 17 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/web/config.py Wed Jul 04 22:36:52 2012 +0800 +++ b/web/config.py Sat Jul 07 23:32:02 2012 +0800 @@ -5,20 +5,22 @@ UPDATE_URL = 'https://evil.ucc.asn.au/~matt/templog/update' -GRAPH_WIDTH = 800 -GRAPH_HEIGHT = 400 -ZOOM = 1.5 +GRAPH_WIDTH = 1200 +GRAPH_HEIGHT = 600 +ZOOM = 1 LINE_WIDTH = 2 SENSOR_NAMES = {'sensor_28 CE B2 1A 03 00 00 99': "Wort", - 'sensor_28 CC C1 1A 03 00 00 D4': "Lid", + 'sensor_28 CC C1 1A 03 00 00 D4': "Ambient", + 'sensor_28 49 BC 1A 03 00 00 54': "Other", 'sensor_voltage': 'Voltage', } SENSOR_COLOURS = {'Wort': 'e49222', - 'Lid': '028b3d', + 'Ambient': '028b3d', 'Voltage': '7db5d3aa', + 'Other': '78000c', }
--- a/web/log.py Wed Jul 04 22:36:52 2012 +0800 +++ b/web/log.py Sat Jul 07 23:32:02 2012 +0800 @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- #:vim:et:ts=4:sts=4:sw=4: import rrdtool import os @@ -65,14 +66,20 @@ have_volts = True vname = 'scalevolts' graph_args.append('DEF:%(vname)s=%(rrdfile)s:temp:AVERAGE:step=3600' % locals()) + unit = 'V' else: vname = 'temp%d' % n graph_args.append('DEF:raw%(vname)s=%(rrdfile)s:temp:AVERAGE' % locals()) graph_args.append('CDEF:%(vname)s=raw%(vname)s,0.1,*,2,+' % locals()) + unit = '<span face="Liberation Serif">ยบ</span>C' + + last_value = float(rrdtool.info(rrdfile)['ds[temp].last_ds']) width = config.LINE_WIDTH legend = config.SENSOR_NAMES.get(sensor, sensor) colour = config.SENSOR_COLOURS.get(legend, colour_from_string(sensor)) - graph_args.append('LINE%(width)f:%(vname)s#%(colour)s:%(legend)s' % locals()) + format_last_value = ('%f' % last_value).rstrip('0') + unit + print_legend = '%s (%s)' % (legend, format_last_value) + graph_args.append('LINE%(width)f:%(vname)s#%(colour)s:%(print_legend)s' % locals()) end = int(start+length) start = int(start) @@ -101,6 +108,7 @@ '--color', 'MGRID#aaaaaa', '--color', 'BACK#ffffff', '--disable-rrdtool-tag', + '--pango-markup', '--watermark', watermark, '--imgformat', 'PNG'] \ + graph_args
--- a/web/views/top.tpl Wed Jul 04 22:36:52 2012 +0800 +++ b/web/views/top.tpl Sat Jul 07 23:32:02 2012 +0800 @@ -16,7 +16,7 @@ <body> <form action="" method="get"> -<span class="no_selection"><input type="image" src="graph.png?{{urlparams}}"/></span> +<span class="no_selection"><input type="image" style="width: 1200px" src="graph.png?{{urlparams}}"/></span> <input type="hidden" name="length" value="{{length}}"/> <input type="hidden" name="end" value="{{end}}"/> <input type="hidden" name="zoom" value="yeah"/>