X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fvalue-axis-formatters.html;h=f69c99da514376f2582eb76f2dc1ffe01a96738a;hb=00eebc92ec7d1846599bf233dbc63b9ea3ac3095;hp=184101e72da4b37cc56d0c952e536e452ef50df7;hpb=27fd63fc0ca45c06318bb47dd8c0f6aa074957b8;p=dygraphs.git
diff --git a/tests/value-axis-formatters.html b/tests/value-axis-formatters.html
index 184101e..f69c99d 100644
--- a/tests/value-axis-formatters.html
+++ b/tests/value-axis-formatters.html
@@ -1,16 +1,9 @@
-
+
valueFormatter and axisLabelFormatter
-
-
-
+
@@ -43,6 +36,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 +54,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 +71,8 @@
},
axisLabelFormatter: function(y) {
return 'yalf(' + y.toPrecision(2) + ')';
- }
+ },
+ axisLabelWidth: 100
},
y2: {
valueFormatter: function(y2) {