Mercurial > templog
diff web/log.py @ 78:c7b6da1adb47
ui tweaks
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 07 Jul 2012 23:32:02 +0800 |
parents | 959e88c0bdfa |
children | 6f4497a448e8 |
line wrap: on
line diff
--- 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