X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fvalue-axis-formatters.html;h=31d61ea2d2ab24a7b7a43543e6b23fff32e8ba4d;hb=287c4d68da47248a301bc9087d3b3c7f4ea36a44;hp=184101e72da4b37cc56d0c952e536e452ef50df7;hpb=d55a912ad2c97a3a0e4de0144157a761005494b3;p=dygraphs.git
diff --git a/tests/value-axis-formatters.html b/tests/value-axis-formatters.html
index 184101e..31d61ea 100644
--- a/tests/value-axis-formatters.html
+++ b/tests/value-axis-formatters.html
@@ -1,16 +1,12 @@
-
valueFormatter and axisLabelFormatter
-
-
+
@@ -43,6 +39,13 @@
1e6 * (2 - i * (100 - i) / (50 * 50))]);
}
+ function formatDate(d) {
+ var yyyy = d.getFullYear(),
+ mm = d.getMonth() + 1,
+ dd = d.getDate();
+ return yyyy + '-' + (mm < 10 ? '0' : '') + mm + (dd < 10 ? '0' : '') + dd;
+ }
+
g = new Dygraph(
document.getElementById("demodiv"),
data,
@@ -54,17 +57,16 @@
'Y3': { axis: 'y2' },
'Y4': { axis: 'y2' }
},
- xAxisLabelWidth: 100,
- yAxisLabelWidth: 100,
axes: {
x: {
valueFormatter: function(ms) {
- return 'xvf(' + new Date(ms).strftime('%Y-%m-%d') + ')';
+ return 'xvf(' + formatDate(new Date(ms)) + ')';
},
axisLabelFormatter: function(d) {
- return 'xalf(' + d.strftime('%Y-%m-%d') + ')';
+ return 'xalf(' + formatDate(d) + ')';
},
pixelsPerLabel: 100,
+ axisLabelWidth: 100,
},
y: {
valueFormatter: function(y) {
@@ -72,7 +74,8 @@
},
axisLabelFormatter: function(y) {
return 'yalf(' + y.toPrecision(2) + ')';
- }
+ },
+ axisLabelWidth: 100
},
y2: {
valueFormatter: function(y2) {