mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Fix charts intervals
This commit is contained in:
parent
df1eb4acde
commit
36df7511c4
2 changed files with 75 additions and 13 deletions
37
httpdocs/js/ntopng_utils.js
vendored
37
httpdocs/js/ntopng_utils.js
vendored
|
|
@ -318,3 +318,40 @@ function epoch2Seen(epoch) {
|
|||
|
||||
return(d.format("dd/MM/yyyy hh:mm:ss")+" ["+secondsToTime(tdiff)+" ago]");
|
||||
}
|
||||
|
||||
/* ticks for graph x axis */
|
||||
function graphGetXAxisTicksFormat(diff_epoch) {
|
||||
var tickFormat;
|
||||
|
||||
if(diff_epoch <= 86400) {
|
||||
tickFormat = "%H:%M:%S";
|
||||
} else if(diff_epoch <= 2*86400) {
|
||||
tickFormat = "%b %e, %H:%M:%S";
|
||||
} else {
|
||||
tickFormat = "%b %e";
|
||||
}
|
||||
|
||||
return(tickFormat);
|
||||
}
|
||||
|
||||
/* ticks for graph tooltip header */
|
||||
function graphGetHeaderTicksFormat(diff_epoch) {
|
||||
var tickFormat;
|
||||
|
||||
/*if(diff_epoch < 86400) {
|
||||
tickFormat = "%H:%M:%S";
|
||||
} else {*/
|
||||
tickFormat = "%b %e, %H:%M:%S";
|
||||
|
||||
return(tickFormat);
|
||||
}
|
||||
|
||||
function nvGraphSetXTicksFormat(chart, diff_epoch) {
|
||||
/* Set the tooltip displayed on mouse over/move */
|
||||
chart.interactiveLayer.tooltip.headerFormatter(function (d) {
|
||||
return d3.time.format(graphGetHeaderTicksFormat(diff_epoch))(new Date(d*1000));
|
||||
});
|
||||
|
||||
/* Set the x axis format */
|
||||
chart.xAxis.tickFormat(function(d) { return d3.time.format(graphGetXAxisTicksFormat(diff_epoch))(new Date(d*1000)) });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue