X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fx-axis-formatter.html;h=ef884e374e99b22fcaf1f0d402c6440cb2543a42;hb=401ff9f17c622f3173cc8d34cfcf3e444620d7d0;hp=9983391fffe4bdf5076c5608ed3c43f2a305ffb2;hpb=872a6a00621c7e18800f75a384b52b88fe751391;p=dygraphs.git
diff --git a/tests/x-axis-formatter.html b/tests/x-axis-formatter.html
index 9983391..ef884e3 100644
--- a/tests/x-axis-formatter.html
+++ b/tests/x-axis-formatter.html
@@ -1,16 +1,12 @@
-
X Axis Label Formatting
-
-
+
@@ -35,6 +31,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"),
@@ -58,13 +57,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());
}
}
}