X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fvalue-axis-formatters.html;h=c7b8a16269efb2daeae17fa6df58779ad9266a46;hb=2a1f00d810b5c4f04b72bc6a393380b858f70909;hp=193c48e2100a263bbab951d821ffbc9531f93d16;hpb=48e614acf3084b9836803f8b014bf0e65f1ca119;p=dygraphs.git
diff --git a/tests/value-axis-formatters.html b/tests/value-axis-formatters.html
index 193c48e..c7b8a16 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,
@@ -50,22 +53,19 @@
labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
width: 640,
height: 350,
- 'Y3': {
- axis: {
- }
- },
- 'Y4': {
- axis: 'Y3' // use the same y-axis as series Y3
+ series: {
+ '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,
},