diff web/log.py @ 227:efb5cad2e98b

Only print interesting legend labels
author Matt Johnston <matt@ucc.asn.au>
date Sat, 28 Feb 2015 00:14:21 +0800
parents 59379b2bd056
children 0a1b642e3086
line wrap: on
line diff
--- 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)