4 <title>X Axis Label Formatting
</title>
6 For production (minified) code, use:
7 <script type=
"text/javascript" src=
"dygraph-combined.js"></script>
9 <script type=
"text/javascript" src=
"../dygraph-dev.js"></script>
14 <div id=
"normal" style=
"width:600px; height:300px;"></div>
16 <p>Same data, but offset by
2 hours with the date formatter:
</p>
17 <div id=
"offby2" style=
"width:600px; height:300px;"></div>
19 <p>Same data, but always displaying HH:MM:SS:
</p>
20 <div id=
"seconds" style=
"width:600px; height:300px;"></div>
22 <script type=
"text/javascript">
23 function HourlyData() {
26 "2009/07/12 00:00:00,3,4\n" +
27 "2009/07/12 01:00:00,5,6\n" +
28 "2009/07/12 02:00:00,7,6\n" +
29 "2009/07/12 03:00:00,6,5\n" +
30 "2009/07/12 04:00:00,4,7\n" +
31 "2009/07/12 05:00:00,3,6\n" +
32 "2009/07/12 06:00:00,4,6"
36 document.getElementById(
"normal"),
41 document.getElementById(
"offby2"),
46 axisLabelFormatter: function(d, gran, opts) {
47 return Dygraph.dateAxisLabelFormatter(new Date(d.getTime() +
7200*
1000), gran, opts);
54 document.getElementById(
"seconds"),
60 axisLabelFormatter: function(d, gran) {
61 return Dygraph.zeropad(d.getHours()) +
":"
62 + Dygraph.zeropad(d.getMinutes()) +
":"
63 + Dygraph.zeropad(d.getSeconds());