4 <meta http-equiv=
"X-UA-Compatible" content=
"IE=EmulateIE7; IE=EmulateIE9">
5 <title>X Axis Label Formatting
</title>
7 <script type=
"text/javascript" src=
"../excanvas.js"></script>
10 For production (minified) code, use:
11 <script type=
"text/javascript" src=
"dygraph-combined.js"></script>
13 <script type=
"text/javascript" src=
"../dygraph-dev.js"></script>
18 <div id=
"normal" style=
"width:600px; height:300px;"></div>
20 <p>Same data, but offset by
2 hours with the date formatter:
</p>
21 <div id=
"offby2" style=
"width:600px; height:300px;"></div>
23 <p>Same data, but always displaying HH:MM:SS:
</p>
24 <div id=
"seconds" style=
"width:600px; height:300px;"></div>
26 <script type=
"text/javascript">
27 function HourlyData() {
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"
40 document.getElementById(
"normal"),
45 document.getElementById(
"offby2"),
50 axisLabelFormatter: function(d, gran, opts) {
51 return Dygraph.dateAxisLabelFormatter(new Date(d.getTime() +
7200*
1000), gran, opts);
58 document.getElementById(
"seconds"),
64 axisLabelFormatter: function(d, gran) {
65 return Dygraph.zeropad(d.getHours()) +
":"
66 + Dygraph.zeropad(d.getMinutes()) +
":"
67 + Dygraph.zeropad(d.getSeconds());