move show_graphs() into *.html
[tridge/solar.git] / live / envir.html
index 6d85e0d0c694d3dfcbcfb96fd269346cadd7fbe5..5d186178c50292b9cd9c8a2c5152bd44892d9ad7 100644 (file)
@@ -57,6 +57,52 @@ if (hashvars['date'] != undefined) {
 first_data = date_round(parse_date("2010-10-07"));
 XML_directory = "../XML/";
 setup_datepicker();
+
+
+/*
+  show all the live data graphs
+ */
+function show_graphs() {
+  hide_div("nodata", true);
+
+  pvdate_base = pvdate.getTime();
+
+  graph_csv_files_func("Recent Data (W)",
+                      xml_files(),
+                      [ "msg.ch1.watts", "msg.ch2.watts", "msg.ch3.watts" ],
+                      null, null,
+                      { includeZero: true,
+                          averaging: false,
+                          maxtime: 15,
+                          series_base: [ 'Time', 'Chan1', 'Chan2', 'Chan3' ]});
+
+  function total(v) {
+    return pow = v[0] + v[1] + v[2];
+  }
+
+  graph_csv_files_func("Total (W)",
+                      xml_files(),
+                      [ "msg.ch1.watts", "msg.ch2.watts", "msg.ch3.watts" ],
+                      total, null,
+                      { includeZero: true,
+                        series_base: 'Total'});
+
+  graph_csv_files("Temperature (C)",
+                 xml_files(),
+                 "msg.tmpr",
+                 { includeZero: false });
+
+  graph_csv_files_func("Channels (W)",
+                      xml_files(),
+                      [ "msg.ch1.watts", "msg.ch2.watts", "msg.ch3.watts" ],
+                      null, null,
+                      { includeZero: true,
+                        series_base: [ 'Time', 'Chan1', 'Chan2', 'Chan3' ]});
+  load_annotations();
+
+  in_redraw = true;
+}
+
 show_graphs();
 </script>