Merge pull request #1578 from prometheus/time-in-hoverdetail

Include date and time in graph hover detail.
This commit is contained in:
Tobias Schmidt 2016-04-22 17:10:00 -04:00
commit 0647926817
2 changed files with 30 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -513,9 +513,10 @@ Prometheus.Graph.prototype.updateGraph = function() {
var hoverDetail = new Rickshaw.Graph.HoverDetail({
graph: self.rickshawGraph,
formatter: function(series, x, y) {
var date = '<span class="date">' + new Date(x * 1000).toUTCString() + '</span>';
var swatch = '<span class="detail_swatch" style="background-color: ' + series.color + '"></span>';
var content = swatch + (series.labels.__name__ || 'value') + ": <strong>" + y + '</strong><br>';
return content + self.renderLabels(series.labels);
var content = swatch + (series.labels.__name__ || 'value') + ": <strong>" + y + '</strong>';
return date + '<br>' + content + '<br>' + self.renderLabels(series.labels);
}
});