changeset 227:efb5cad2e98b

Only print interesting legend labels
author Matt Johnston <matt@ucc.asn.au>
date Sat, 28 Feb 2015 00:14:21 +0800
parents da769023bf08
children d9e81a563923
files web/config.py web/log.py
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/web/config.py	Sat Feb 28 00:14:02 2015 +0800
+++ b/web/config.py	Sat Feb 28 00:14:21 2015 +0800
@@ -34,6 +34,9 @@
     'sensor_internal': "Processor",
     }
 
+# print legend for these ones
+LEGEND_NAMES = set(("Wort", "Fridge", "Ambient", "Setpoint"))
+
 SENSOR_COLOURS = {'Wort': 'e49222', 
                 'Ambient': '028b3d',
                 'Voltage': '7db5d3aa',
--- a/web/log.py	Sat Feb 28 00:14:02 2015 +0800
+++ b/web/log.py	Sat Feb 28 00:14:21 2015 +0800
@@ -115,11 +115,13 @@
         width = config.LINE_WIDTH
         legend = config.SENSOR_NAMES.get(sensor, sensor)
         colour = config.SENSOR_COLOURS.get(legend, colour_from_string(sensor))
-        if format_last_value:
-            print_legend = '%s (%s)' % (legend, format_last_value)
-        else:
-            print_legend = legend
-        sensor_lines.append( (legend, 'LINE%(width)f:%(vname)s#%(colour)s:%(print_legend)s' % locals()) )
+        print_legend = ''
+        if legend in config.LEGEND_NAMES:
+            if format_last_value:
+                print_legend = ':%s (%s)' % (legend, format_last_value)
+            else:
+                print_legend = ":%s" % legend
+        sensor_lines.append( (legend, 'LINE%(width)f:%(vname)s#%(colour)s%(print_legend)s' % locals()) )
         if legend == 'Wort':
             wort_sensor = vname
         elif legend == 'Fridge':
@@ -127,13 +129,12 @@
 
     # calculated bits
     colour = '000000'
-    print_legend = 'Heat'
     graph_args.append('CDEF:wortdel=%(wort_sensor)s,PREV(%(wort_sensor)s),-' % locals())
     graph_args.append('CDEF:tempdel=%(wort_sensor)s,%(fridge_sensor)s,-' % locals())
     graph_args.append('CDEF:fermheat=wortdel,80,*,tempdel,0.9,*,+' % locals())
     graph_args.append('CDEF:trendfermheat=fermheat,7200,TRENDNAN' % locals())
     graph_args.append('CDEF:limitfermheat=trendfermheat,5,+,11,MIN,2,MAX' % locals())
-    graph_args.append('LINE0.5:limitfermheat#%(colour)s:%(print_legend)s' % locals())
+    graph_args.append('LINE0.5:limitfermheat#%(colour)s' % locals())
 
     # lines are done afterwards so they can be layered
     sensor_lines.sort(key = lambda (legend, line): "Wort" in legend)