changeset 478:fc8ddea46987

sort sensor lines
author Matt Johnston <matt@ucc.asn.au>
date Thu, 30 Jan 2014 22:56:05 +0800
parents a40f30fad8f6
children 3ac15a9be1b6
files web/log.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
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)