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