diff web/log.py @ 179:30390852cb5d

sort sensor lines
author Matt Johnston <matt@ucc.asn.au>
date Thu, 30 Jan 2014 22:56:05 +0800
parents 632d436d227b
children e731c0d30b09
line wrap: on
line diff
--- a/web/log.py	Mon Jan 21 07:25:52 2013 +0800
+++ b/web/log.py	Thu Jan 30 22:56:05 2014 +0800
@@ -78,6 +78,9 @@
 
     volts_mult = 1.0/volts_div
 
+    # (title, sensorline) pairs.
+    sensor_lines = []
+
     for n, (rrdfile, sensor) in enumerate(rrds):
         unit = None
         if 'avrtemp' in sensor:
@@ -112,7 +115,11 @@
             print_legend = '%s (%s)' % (legend, format_last_value)
         else:
             print_legend = legend
-        graph_args.append('LINE%(width)f:%(vname)s#%(colour)s:%(print_legend)s' % locals())
+        sensor_lines.append( (legend, 'LINE%(width)f:%(vname)s#%(colour)s:%(print_legend)s' % locals()) )
+
+    sensor_lines.sort(key = lambda (legend, line): "Wort" in legend)
+
+    graph_args += (line for (legend, line) in sensor_lines)
 
     end = int(start+length)
     start = int(start)