Include date and time in graph hover detail.

This is the same solution as applied to PromDash in
https://github.com/prometheus/promdash/pull/72.

Fixes https://github.com/prometheus/prometheus/issues/1569
This commit is contained in:
Julius Volz 2016-04-22 23:00:18 +02:00
parent bf0897bea5
commit c78bd13a2b
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);
}
});