-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dygraph.dateString_: shows milliseconds if any. (#774)
* [utils] dateString_ display Milliseconds if any * [utils] fix dateAxisLabelFormatter milliseconds * [util] dateString_: compute ms in frac * [utils] clean hmsString_ format * [utils] add milliseconds padding in hmsString_ * [develop] add note on npm install * [tests] add labelsDateMilliseconds test * [utils] add millis in dateAxisLabelFormatter * [tests] fix requested changes in labelsDateMillis * [auto_tests] add date_formats testMillisecondsDate
- Loading branch information
1 parent
8cc4108
commit 2d0fdf6
Showing
4 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Milliseconds date labels</title> | ||
<!-- | ||
For production (minified) code, use: | ||
<script type="text/javascript" src="dygraph-combined.js"></script> | ||
--> | ||
<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"> | ||
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> |