more x-axis time resolutions
[dygraphs.git] / tests / hourly.html
... / ...
CommitLineData
1<html>
2 <head>
3 <title>noise</title>
4 <!--[if IE]>
5 <script type="text/javascript" src="excanvas.js"></script>
6 <![endif]-->
7 <script type="text/javascript" src="../dygraph-combined.js"></script>
8 <script type="text/javascript" src="../dygraph.js"></script>
9 </head>
10 <body>
11 <p>Hourly data:</p>
12 <div id="g" style="width:600px; height:300px;"></div>
13
14 <p>Minutely data:</p>
15 <div id="gm" style="width:600px; height:300px;"></div>
16
17 <p>Secondly data:</p>
18 <div id="gs" style="width:600px; height:300px;"></div>
19
20 <script type="text/javascript">
21 g = new DateGraph(
22 document.getElementById("g"),
23 function HourlyData() {
24 return "" +
25 "Date,A,B\n" +
26 "2009/07/12 00:00:00,3,4\n" +
27 "2009/07/12 01:00:00,5,6\n" +
28 "2009/07/12 02:00:00,7,6\n" +
29 "2009/07/12 03:00:00,6,5\n" +
30 "2009/07/12 04:00:00,4,7\n" +
31 "2009/07/12 05:00:00,3,6\n" +
32 "2009/07/12 06:00:00,4,6"
33 }, null, {}
34 );
35
36 gm = new DateGraph(
37 document.getElementById("gm"),
38 function() {
39 var ret = "Date,Hours,Minutes\n";
40 var zp = function(x) { if (x<10) return "0"+x; else return ""+x;};
41 for (var d = 0; d <= 1; d++) {
42 for (var h = 0; h < 24; h++) {
43 for (var m = 0; m < 60; m++) {
44 ret += "2008/07/" + zp(12 + d) + " " + zp(h) + ":" + zp(m) +
45 "," + (24*d + h) + "," + m + "\n";
46 }
47 }
48 }
49 return ret;
50 }, null, {}
51 );
52
53 gs = new DateGraph(
54 document.getElementById("gs"),
55 function() {
56 var ret = "Date,Minutes,Seconds\n";
57 var zp = function(x) { if (x<10) return "0"+x; else return ""+x;};
58 for (var h = 0; h <= 1; h++) {
59 for (var m = 0; m < 60; m++) {
60 for (var s = 0; s < 60; s++) {
61 ret += "2008/07/01 " + zp(h) + ":" + zp(m) + ":" + zp(s) +
62 "," + (h*60 + m) + "," + s + "\n";
63 }
64 }
65 }
66 return ret;
67 }, null, {}
68 );
69 </script>
70 </body>
71</html>