changeset 377:55710361804b

swap the left and right scales, kind of clunky
author Matt Johnston <matt@ucc.asn.au>
date Fri, 29 Jun 2012 22:46:59 +0800
parents f22427bcfda8
children 16f96019a9e0 fed6738be1ab
files web/log.py
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/web/log.py	Wed Jun 27 23:41:50 2012 +0800
+++ b/web/log.py	Fri Jun 29 22:46:59 2012 +0800
@@ -62,11 +62,11 @@
         if 'voltage' in sensor:
             have_volts = True
             vname = 'scalevolts'
-            graph_args = ['DEF:rawvolts=%(rrdfile)s:temp:AVERAGE:step=3600' % locals(),
-                        'CDEF:scalevolts=rawvolts,2,-,0.1,/'] + graph_args
+            graph_args.append('DEF:%(vname)s=%(rrdfile)s:temp:AVERAGE:step=3600' % locals())
         else:
             vname = 'temp%d' % n
-            graph_args.append('DEF:%(vname)s=%(rrdfile)s:temp:AVERAGE' % locals())
+            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())
         width = config.LINE_WIDTH
         legend = config.SENSOR_NAMES.get(sensor, sensor)
         colour = config.SENSOR_COLOURS.get(legend, colour_from_string(sensor))
@@ -90,8 +90,9 @@
         '-h', str(config.GRAPH_HEIGHT),
         '--slope-mode',
         '--border', '0',
-        '--vertical-label', 'Temperature',
-        '--y-grid', '1:1',
+        '--vertical-label', 'Voltage',
+        '--y-grid', '0.1:1',
+        '--dynamic-labels',
         '--grid-dash', '1:0',
         '--color', 'GRID#00000000',
         '--color', 'MGRID#aaaaaa',
@@ -103,9 +104,9 @@
     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
+        args += ['--right-axis', '10:-20', # matches the scalevolts CDEF above
             '--right-axis-format', '%.2lf',
-            '--right-axis-label', 'Voltage']
+            '--right-axis-label', 'Temperature']
 
     rrdtool.graph(*args)
     return tempf.read()