X-Git-Url: http://www.average.org/gitweb/?p=pulsecounter.git;a=blobdiff_plain;f=web%2Findex.html;h=9170885ed902f4ce41728adc2dace7b4e6bf5ab9;hp=72bd9f9d5f5edb5fd425f9d823044af77d6f3ea6;hb=97b05be5674c0fa9562ce531a12f89e7462dcc6b;hpb=fcca95634eda4df11fc367c294e34203ad3bc934
diff --git a/web/index.html b/web/index.html
index 72bd9f9..9170885 100644
--- a/web/index.html
+++ b/web/index.html
@@ -13,6 +13,11 @@
var xzero = 20, yzero = 20;
var cold_d = [], hot_d = [];
+ function showdate(utime) {
+ var dt = new Date(utime*1000);
+ return dt.toLocaleDateString() + " " + dt.toLocaleTimeString();
+ }
+
function getcomb(lo, hi) {
var comb = [], lb = [];
var d = hi - lo;
@@ -142,6 +147,8 @@
(data.current.hot / 100).toFixed(2);
tmin = data.range.lo;
tmax = data.range.hi;
+ dbg.innerHTML = "from " + tmin + " to " + tmax
+ + "
from " + showdate(tmin) + " to " + showdate(tmax);
/* differetiate() updates hmax */
hmax = 0;
cold_d = differentiate(data.cold);
@@ -151,11 +158,14 @@
redraw();
}
+ function iso2qu(idate) {
+ return idate.replace("T", "+").replace("0Z", "");
+ }
+
function sendquery(lo, hi) {
- var url = "query.cgi";
+ var url = "query.cgi" + "?lo=" + iso2qu(lo) + "&hi=" + iso2qu(hi);
- if (lo && hi) url += "?lo=" + lo + "&" + hi;
- else url = "query.cgi?lo=2015-12-19+00:00:00&hi=2015-12-20+00:00:00"; //FIX
+ //dbg.innerHTML = url;
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
// dbg.innerHTML = xmlhttp.responseText;
@@ -179,12 +189,21 @@
}
function initialize() {
+ var tdy = new Date();
+ var tmr;
+
+ tdy.setMilliseconds(0);
+ tdy.setSeconds(0);
+ tdy.setMinutes(0);
+ tdy.setHours(0);
+ tmr = new Date(1*tdy + 86400000);
dbg = document.getElementById("debug");
canvas = document.getElementById("plot");
ctx = canvas.getContext("2d");
- xmlhttp = new XMLHttpRequest();
resize();
- sendquery();
+
+ xmlhttp = new XMLHttpRequest();
+ sendquery(tdy.toISOString(), tmr.toISOString());
}
/* Set up */
@@ -197,8 +216,18 @@
}