X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fx-axis-formatter.html;h=3f8f01ce87b89b757d94614c5921b25431e0c84a;hb=59ee387ba6d5113ceedba2b16b1c0c53ddfa072c;hp=d216c9796afbc593fe3a350c907529b301e7d94e;hpb=e26b71566419e1c051f3fbd1f4f8f64b063a04c9;p=dygraphs.git
diff --git a/tests/x-axis-formatter.html b/tests/x-axis-formatter.html
index d216c97..3f8f01c 100644
--- a/tests/x-axis-formatter.html
+++ b/tests/x-axis-formatter.html
@@ -1,16 +1,9 @@
-
+
X Axis Label Formatting
-
-
-
+
@@ -35,6 +28,9 @@
"2009/07/12 05:00:00,3,6\n" +
"2009/07/12 06:00:00,4,6"
}
+ function zeropad(x) {
+ return (x < 10) ? '0' + x : x;
+ }
var g1 = new Dygraph(
document.getElementById("normal"),
@@ -47,8 +43,8 @@
{
axes: {
x: {
- axisLabelFormatter: function(d, gran) {
- return Dygraph.dateAxisFormatter(new Date(d.getTime() + 7200*1000), gran);
+ axisLabelFormatter: function(d, gran, opts) {
+ return Dygraph.dateAxisLabelFormatter(new Date(d.getTime() + 7200*1000), gran, opts);
}
}
}
@@ -58,13 +54,13 @@
document.getElementById("seconds"),
HourlyData(),
{
- xAxisLabelWidth: 70,
axes: {
x: {
+ axisLabelWidth: 70,
axisLabelFormatter: function(d, gran) {
- return Dygraph.zeropad(d.getHours()) + ":"
- + Dygraph.zeropad(d.getMinutes()) + ":"
- + Dygraph.zeropad(d.getSeconds());
+ return zeropad(d.getHours()) + ":"
+ + zeropad(d.getMinutes()) + ":"
+ + zeropad(d.getSeconds());
}
}
}