Bug fix for dygraph point selection touch event.
[dygraphs.git] / tests / daylight-savings.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="stylesheet" href="../dist/dygraph.css">
5 <title>Daylight Savings</title>
6 <script type="text/javascript" src="../dist/dygraph.js"></script>
7
8 <style>
9 body {
10 max-width: 1024px;
11 }
12 </style>
13
14 </head>
15 <body>
16 <h2>DST</h2>
17 <p>This tests that tick marks don't break when the axis crosses into
18 daylight savings time.</p>
19
20 <div id="demodiv"></div>
21
22 <p>The tick marks should all be on day boundaries or nice hours (6, 12, 18),
23 rather than on odd time boundaries like 5, 11, 17 and 23.</p>
24
25 <hr/>
26 <div id="chart2"></div>
27 <p>This chart shows a continuous line going across the "fall back" EST/EDT event. You may need to switch your computer's time zone to Eastern to see this. The x-axis tick marks go from 01:00 &rarr; 01:55 and then back to 01:00.</p>
28
29 <hr/>
30 <div id="chart3"></div>
31 <p>This chart is analogous to the first, except at a "spring forward".</p>
32
33 <hr/>
34 <div id="chart4"></div>
35 <p>This chart shows a continuous series which crosses a "spring forward". The x-axis ticks should skip from 1:55AM to 3:00AM.</p>
36
37 <script type="text/javascript">
38 g = new Dygraph(
39 document.getElementById("demodiv"),
40 "Date/Time,Purchases\n" +
41 "2010-11-05 00:00:00,167082\n" +
42 "2010-11-06 00:00:00,168571\n" +
43 "2010-11-07 00:00:00,177796\n" +
44 "2010-11-08 00:00:00,165587\n" +
45 "2010-11-09 00:00:00,164380\n",
46 {
47 width: 1024
48 }
49 );
50
51 // Generate data which crosses the EST/EDT boundary.
52 var dst_data = [];
53 var base_ms = 1383454200000;
54 for (var x = base_ms; x < base_ms + 1000 * 60 * 80; x += 1000) {
55 dst_data.push([new Date(x), x]);
56 }
57
58 g2 = new Dygraph(
59 document.getElementById("chart2"),
60 dst_data,
61 { width: 1024, labels: ['Date', 'Value'] }
62 );
63
64 g3 = new Dygraph(
65 document.getElementById("chart3"),
66 "Date/Time,Purchases\n" +
67 "2011-03-11 00:00:00,167082\n" +
68 "2011-03-12 00:00:00,168571\n" +
69 "2011-03-13 00:00:00,177796\n" +
70 "2011-03-14 00:00:00,165587\n" +
71 "2011-03-15 00:00:00,164380\n",
72 {
73 width: 1024,
74 dateWindow: [1299989043119.4365, 1300080693627.4866]
75 }
76 );
77
78 var base_ms_spring = 1299999000000;
79 var dst_data_spring = [];
80 for (var x = base_ms_spring; x < base_ms_spring + 1000 * 60 * 80; x += 1000) {
81 dst_data_spring.push([new Date(x), x]);
82 }
83
84 g4 = new Dygraph(
85 document.getElementById("chart4"),
86 dst_data_spring,
87 { width: 1024, labels: ['Date', 'Value'] }
88 );
89
90 </script>
91 </body>
92 </html>