Merge pull request #507 from danvk/markdown-readme
[dygraphs.git] / tests / daylight-savings.html
CommitLineData
54425b14 1<!DOCTYPE html>
d1bce5a0
DV
2<html>
3 <head>
4 <title>Daylight Savings</title>
7e5ddc94
DV
5 <!--
6 For production (minified) code, use:
7 <script type="text/javascript" src="dygraph-combined.js"></script>
8 -->
9 <script type="text/javascript" src="../dygraph-dev.js"></script>
10
0b4cf8f0
DV
11 <style>
12 body {
13 max-width: 1024px;
14 }
15 </style>
16
d1bce5a0
DV
17 </head>
18 <body>
19 <h2>DST</h2>
20 <p>This tests that tick marks don't break when the axis crosses into
21 daylight savings time.</p>
22
23 <div id="demodiv"></div>
24
35a3b119
DV
25 <p>The tick marks should all be on day boundaries or nice hours (6, 12, 18),
26 rather than on odd time boundaries like 5, 11, 17 and 23.</p>
27
fef315fe
DV
28 <hr/>
29 <div id="chart2"></div>
30 <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>
31
0b4cf8f0
DV
32 <hr/>
33 <div id="chart3"></div>
34 <p>This chart is analogous to the first, except at a "spring forward".</p>
35
36 <hr/>
37 <div id="chart4"></div>
38 <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>
39
d1bce5a0
DV
40 <script type="text/javascript">
41 g = new Dygraph(
42 document.getElementById("demodiv"),
43"Date/Time,Purchases\n" +
44"2010-11-05 00:00:00,167082\n" +
45"2010-11-06 00:00:00,168571\n" +
46"2010-11-07 00:00:00,177796\n" +
47"2010-11-08 00:00:00,165587\n" +
35a3b119 48"2010-11-09 00:00:00,164380\n",
0f9bf369
DV
49 {
50 width: 1024
51 }
d1bce5a0 52 );
fef315fe
DV
53
54 // Generate data which crosses the EST/EDT boundary.
55 var dst_data = [];
56 var base_ms = 1383454200000;
57 for (var x = base_ms; x < base_ms + 1000 * 60 * 80; x += 1000) {
58 dst_data.push([new Date(x), x]);
59 }
60
0b4cf8f0 61 g2 = new Dygraph(
fef315fe
DV
62 document.getElementById("chart2"),
63 dst_data,
64 { width: 1024, labels: ['Date', 'Value'] }
65 );
0b4cf8f0
DV
66
67 g3 = new Dygraph(
68 document.getElementById("chart3"),
69"Date/Time,Purchases\n" +
70"2011-03-11 00:00:00,167082\n" +
71"2011-03-12 00:00:00,168571\n" +
72"2011-03-13 00:00:00,177796\n" +
73"2011-03-14 00:00:00,165587\n" +
74"2011-03-15 00:00:00,164380\n",
75 {
76 width: 1024,
77 dateWindow: [1299989043119.4365, 1300080693627.4866]
78 }
79 );
80
81 var base_ms_spring = 1299999000000;
82 var dst_data_spring = [];
83 for (var x = base_ms_spring; x < base_ms_spring + 1000 * 60 * 80; x += 1000) {
84 dst_data_spring.push([new Date(x), x]);
85 }
86
87 g4 = new Dygraph(
88 document.getElementById("chart4"),
89 dst_data_spring,
90 { width: 1024, labels: ['Date', 'Value'] }
91 );
92
d1bce5a0
DV
93 </script>
94</body>
95</html>