1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Milliseconds date labels</title>
<link rel="stylesheet" type="text/css" href="../dist/dygraph.css" />
<link rel="stylesheet" type="text/css" href="../common/vextlnk.css" />
<script type="text/javascript" src="../dist/dygraph.js"></script>
</head>
<body>
<h2>Milliseconds display in date and time labels</h2>
<p>This shows how milliseconds are displayed when present.</p>
<div id="div_ms" style="width:600px; height:200px;"></div>
<div id="div_std" style="width:600px; height:200px;"></div>
<p>You can check it by hovering over corresponding points and comparing
the value labels.</p>
<script type="text/javascript"><!--//--><![CDATA[//><!--
Dygraph.onDOMready(function onDOMready() {
var values = (function () {
var rand10 = function () { return Math.round(10 * Math.random()); };
var a = [];
for (var n=0; n < 72; n++) {
a.push(rand10());
}
return a;
})();
function data(y,m,d,hh,mm,ss,ms) {
var a = [];
for (var n=0; n < 72; n++) {
a.push([new Date(Date.UTC(y, m, d, hh + n, mm, ss, ms)), values[n]]);
}
return a;
}
gms = new Dygraph(
document.getElementById("div_ms"),
data(2009, 6, 25, 14, 34, 56, 654),
{
labels: ['time with ms', 'random']
}
);
gstd = new Dygraph(
document.getElementById("div_std"),
data(2009, 6, 25, 14, 0, 0, 0),
{
labels: ['time', 'random']
}
);
});
//--><!]]></script>
</body>
</html>
|