<!DOCTYPE html>
<html>
<head>
- <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
+ <link rel="stylesheet" href="../dist/dygraph.css">
<title>valueFormatter and axisLabelFormatter</title>
- <!--[if IE]>
- <script type="text/javascript" src="../excanvas.js"></script>
- <![endif]-->
- <!--
- For production (minified) code, use:
- <script type="text/javascript" src="dygraph-combined.js"></script>
- -->
- <script type="text/javascript" src="../dygraph-dev.js"></script>
+ <script type="text/javascript" src="../dist/dygraph.js"></script>
</head>
<body style="max-width: 800px;">
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,
'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) {
},
axisLabelFormatter: function(y) {
return 'yalf(' + y.toPrecision(2) + ')';
- }
+ },
+ axisLabelWidth: 100
},
y2: {
valueFormatter: function(y2) {