mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added relative time by default, removed checkbox
This commit is contained in:
parent
af65a81d5b
commit
e0b585779d
@ -226,7 +226,7 @@ function (angular, $, kbn, _, moment) {
|
||||
moment.utc(date).format(format);
|
||||
};
|
||||
|
||||
p.formatRelativeDate = function(date) {
|
||||
p.getRelativeTime = function(date) {
|
||||
|
||||
date = this.checkDate(date);
|
||||
|
||||
|
@ -32,12 +32,7 @@ function ($) {
|
||||
};
|
||||
|
||||
this.showTooltip = function(absoluteTime, relativeTime, innerHtml, pos) {
|
||||
var body;
|
||||
if(typeof relativeTime === 'undefined') {
|
||||
body = '<div class="graph-tooltip small"><div class="graph-tooltip-time">'+ absoluteTime + '</div> ' ;
|
||||
} else {
|
||||
body = '<div class="graph-tooltip small"><div class="graph-tooltip-time">'+ absoluteTime + '<br>(' + relativeTime + ')</div> ' ;
|
||||
}
|
||||
var body = '<div class="graph-tooltip small"><div class="graph-tooltip-time">'+ absoluteTime + '<br>(' + relativeTime + ')</div> ' ;
|
||||
body += innerHtml + '</div>';
|
||||
$tooltip.html(body).place_tt(pos.pageX + 20, pos.pageY);
|
||||
};
|
||||
@ -123,10 +118,7 @@ function ($) {
|
||||
|
||||
seriesHtml = '';
|
||||
|
||||
if(scope.panel.tooltip.relativeTimestamp) {
|
||||
relativeTime = dashboard.formatRelativeDate(seriesHoverInfo.time);
|
||||
}
|
||||
|
||||
relativeTime = dashboard.getRelativeTime(seriesHoverInfo.time);
|
||||
absoluteTime = dashboard.formatDate(seriesHoverInfo.time);
|
||||
|
||||
for (i = 0; i < seriesHoverInfo.length; i++) {
|
||||
@ -163,15 +155,12 @@ function ($) {
|
||||
|
||||
value = series.formatValue(value);
|
||||
|
||||
if(scope.panel.tooltip.relativeTimestamp) {
|
||||
relativeTime = dashboard.formatRelativeDate(item.datapoint[0]);
|
||||
}
|
||||
|
||||
relativeTime = dashboard.getRelativeTime(item.datapoint[0]);
|
||||
absoluteTime = dashboard.formatDate(item.datapoint[0]);
|
||||
|
||||
group += '<div class="graph-tooltip-value">' + value + '</div>';
|
||||
|
||||
self.showTooltipOther(absoluteTime, relativeTime, group, pos);
|
||||
self.showTooltip(absoluteTime, relativeTime, group, pos);
|
||||
}
|
||||
// no hit
|
||||
else {
|
||||
|
@ -52,10 +52,6 @@
|
||||
text="All series" model="panel.tooltip.shared" change="render()"
|
||||
tip="Show all series on same tooltip and a x croshair to help follow all series">
|
||||
</editor-opt-bool>
|
||||
<editor-opt-bool
|
||||
text="Relative timestamp" model="panel.tooltip.relativeTimestamp" change="render()"
|
||||
tip="Shows elapsed time in relatively from the current timestamp. For example, 45 mins ago, 1 day 2 hours ago, etc.">
|
||||
</editor-opt-bool>
|
||||
<div class="editor-option" ng-show="panel.stack">
|
||||
<label class="small">Stacked Values <tip>How should the values in stacked charts to be calculated?</tip></label>
|
||||
<select class="input-small" ng-model="panel.tooltip.value_type" ng-options="f for f in ['cumulative','individual']" ng-change="render()"></select>
|
||||
|
Loading…
Reference in New Issue
Block a user