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