1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
9 function drawplot(times, color) {
10 var tmin = times[0][0];
11 var tfact = 640/(times[times.length-1][0] - tmin);
17 for (i = 1; i < times.length; i++) {
18 height[i] = 1 / (times[i][0] - times[i-1][0]);
19 if (hmax < height[i]) hmax = height[i];
21 height[i+1] = height[i];
24 context.moveTo(0, 480 - height[1]*hfact);
25 for (i = 1; i < times.length; i++) {
26 context.lineTo((times[i][0] - tmin)*tfact,480 - height[i]*hfact);
27 context.lineTo((times[i][0] - tmin)*tfact,480 - height[i+1]*hfact);
29 context.strokeStyle = color;
32 function gotdata(data) {
33 canvas = document.getElementById("plot");
34 context = canvas.getContext("2d");
35 drawplot(data.cold, "blue");
36 drawplot(data.hot, "red");
40 <canvas id="plot" width="640" height = "480"
41 style="border:solid 1px #000000;"></canvas>
46 var xmlhttp = new XMLHttpRequest();
47 var url = "query.cgi";
49 xmlhttp.onreadystatechange = function() {
50 if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
51 document.getElementById("debug").innerHTML = xmlhttp.responseText;
52 var myData = JSON.parse(xmlhttp.responseText);
56 xmlhttp.open("GET", url, true);