Skip to content

Commit

Permalink
時刻がある場合には時刻まで表示するようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
Akiyah committed Jan 12, 2016
1 parent a154ede commit 10e3e23
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions public/js/site.js
Expand Up @@ -3,6 +3,17 @@ function round(num, places) {
var shift = Math.pow(10, places);
return Math.round(num * shift)/shift;
};
function formatDate(date) {
var yyyy = date.getFullYear();
var mm = ('0' + (date.getMonth() + 1)).slice(-2);
var dd = ('0' + date.getDate()).slice(-2);
var hh = ('0' + date.getHours()).slice(-2);
var ii = ('0' + date.getMinutes()).slice(-2);
var ss = ('0' + date.getSeconds()).slice(-2);
var yyyymmdd = yyyy + '/' + mm + '/' + dd;
var hhii = hh + ':' + ii;
return yyyymmdd + ((hhii == '00:00') ? '' : ' ' + hhii);
}
function formatValue(v) {
if (v < 1000) return v;
var magnitude = Math.floor(String(Math.floor(v)).length / 3);
Expand Down Expand Up @@ -128,9 +139,8 @@ function loadGraphs () {
$('#tooltip .total').text("TOTAL: " + addFigureVal(total));
}
$('#tooltip').show();
$('#tooltip').css({left:e.pageX, top:e.pageY});
var date = new Date(x)
$('#tooltip .xval').text(date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate() + ':');
$('#tooltip').css({left:e.pageX + 10, top:e.pageY + 10});
$('#tooltip .xval').text(formatDate(new Date(x)) + ':');
for (var i in pts) {
if (pts[i].name == name) {
$('#tooltip .yval').text(name + ': ' + addFigureVal(pts[i].yval));
Expand Down

0 comments on commit 10e3e23

Please sign in to comment.