var ww, wh;
var hmax, hfact;
var tmin, tmax, tfact;
- var xzero = 20, yzero = 20;
+ var xzero = 36, yzero = 24;
var cold_d = [], hot_d = [];
function showdate(utime) {
var scl = Math.floor(d / ord);
var inc, inc2, first, x, lb;
- if (scl < 2) { inc = 0.1; inc2 = 0.5; }
- else if (scl < 5) { inc = 0.2; inc2 = 1; }
- else { inc = 0.5; inc2 = 2; }
+ if (scl < 2) { inc = 0.1; inc2 = 0.2; }
+ else if (scl < 5) { inc = 0.1; inc2 = 0.2; }
+ else { inc = 0.5; inc2 = 1; }
inc *= ord;
inc2 *= ord;
first = (Math.floor(lo / inc) + 1) * inc;
- for (x = 0; x < (d / inc) - 1.5; x++)
+ for (x = 0; x < (d / inc) - 1.2; x++)
comb.push(first + inc * x);
first = (Math.floor(lo / inc2) + 1) * inc2;
- for (x = 0; x < (d / inc2) - 1.5; x++)
+ for (x = 0; x < (d / inc2) - 1.2; x++)
lb.push(first + inc2 * x);
//dbg.innerHTML = "ord=" + ord + "<br>inc=" + inc + "<br>"
// + comb + "<br>" + lb;
ctx.stroke();
ctx.fillStyle = "black";
- ctx.font = "bold 8px Courier";
+ ctx.font = "bold 12px Courier";
ctx.textAlign = "left";
- ctx.fillText(showdate(tmin), px(tmin), py(0) + 16);
+ ctx.fillText(showdate(tmin), px(tmin), py(0) + 20);
ctx.textAlign = "right";
- ctx.fillText(showdate(tmax), px(tmax), py(0) + 16);
+ ctx.fillText(showdate(tmax), px(tmax), py(0) + 20);
}
function yaxis() {
ctx.stroke();
ctx.fillStyle = "black";
- ctx.font = "bold 8px Courier";
+ ctx.font = "bold 12px Courier";
ctx.textAlign = "right";
- ctx.fillText(0, px(tmin) - 2, py(0));
+ ctx.fillText(0, px(tmin) - 6, py(0));
for (i = 0; comb[1][i]; i++) {
- ctx.fillText(comb[1][i], px(tmin) - 2, py(comb[1][i]));
+ ctx.fillText(comb[1][i].toFixed(1), px(tmin) - 6, py(comb[1][i]));
}
ctx.textAlign = "left";
- ctx.fillText("l/h", px(tmin) + 2, py(hmax) + 8);
+ ctx.fillText("l/h", px(tmin) + 4, py(hmax) + 8);
}
/* @ updates global var `hmax` */
display: block;
width: 640px;
height: 320px;
- /*border: solid 1px black;*/
+ /* border: solid 1px black; */
}
div#queries {
margin-left: auto;
}
div.query {
display: inline-block;
+ position: relative;
width: 8em;
height: 8em;
border: solid 1px black;
cursor: pointer;
vertical-align: middle;
}
-span.query {
- display: inline-block;
- vertical-align: middle; /* does not work for some reason */
+div.label {
+ display: block;
+ width: 100%;
+ position: absolute;
+ top: 50%;
+ transform: translate(0, -50%);
+ vertical-align: middle;
}
body {
margin: 0px;
<canvas id="plot" width="640" height = "320"></canvas>
<br />
<div id="queries">
- <div class="query" id="prevweek"><span class="query">PREV WEEK</span></div>
- <div class="query" id="beforeyesterday"><span class="query">DAY
- BEFORE YESTERDAY</span></div>
- <div class="query" id="yesterday"><span class="query">YESTERDAY</span></div>
- <div class="query" id="today"><span class="query">TODAY</span></div>
- <div class="query" id="thisweek"><span class="query">THIS WEEK</span></div>
+ <div class="query" id="prevweek"><div class="label">PREVIOUS WEEK</div></div>
+ <div class="query" id="beforeyesterday"><div class="label">DAY
+ BEFORE YESTERDAY</div></div>
+ <div class="query" id="yesterday"><div class="label">YESTERDAY</div></div>
+ <div class="query" id="today"><div class="label">TODAY</div></div>
+ <div class="query" id="thisweek"><div class="label">THIS WEEK</div></div>
</div>
<br />
<div id="debug"></div>