Commit e0b58577 by utkarshcmu

Added relative time by default, removed checkbox

parent af65a81d
...@@ -226,7 +226,7 @@ function (angular, $, kbn, _, moment) { ...@@ -226,7 +226,7 @@ function (angular, $, kbn, _, moment) {
moment.utc(date).format(format); moment.utc(date).format(format);
}; };
p.formatRelativeDate = function(date) { p.getRelativeTime = function(date) {
date = this.checkDate(date); date = this.checkDate(date);
......
...@@ -32,12 +32,7 @@ function ($) { ...@@ -32,12 +32,7 @@ function ($) {
}; };
this.showTooltip = function(absoluteTime, relativeTime, innerHtml, pos) { this.showTooltip = function(absoluteTime, relativeTime, innerHtml, pos) {
var body; var body = '<div class="graph-tooltip small"><div class="graph-tooltip-time">'+ absoluteTime + '<br>(' + relativeTime + ')</div> ' ;
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> ' ;
}
body += innerHtml + '</div>'; body += innerHtml + '</div>';
$tooltip.html(body).place_tt(pos.pageX + 20, pos.pageY); $tooltip.html(body).place_tt(pos.pageX + 20, pos.pageY);
}; };
...@@ -123,10 +118,7 @@ function ($) { ...@@ -123,10 +118,7 @@ function ($) {
seriesHtml = ''; seriesHtml = '';
if(scope.panel.tooltip.relativeTimestamp) { relativeTime = dashboard.getRelativeTime(seriesHoverInfo.time);
relativeTime = dashboard.formatRelativeDate(seriesHoverInfo.time);
}
absoluteTime = dashboard.formatDate(seriesHoverInfo.time); absoluteTime = dashboard.formatDate(seriesHoverInfo.time);
for (i = 0; i < seriesHoverInfo.length; i++) { for (i = 0; i < seriesHoverInfo.length; i++) {
...@@ -163,15 +155,12 @@ function ($) { ...@@ -163,15 +155,12 @@ function ($) {
value = series.formatValue(value); value = series.formatValue(value);
if(scope.panel.tooltip.relativeTimestamp) { relativeTime = dashboard.getRelativeTime(item.datapoint[0]);
relativeTime = dashboard.formatRelativeDate(item.datapoint[0]);
}
absoluteTime = dashboard.formatDate(item.datapoint[0]); absoluteTime = dashboard.formatDate(item.datapoint[0]);
group += '<div class="graph-tooltip-value">' + value + '</div>'; group += '<div class="graph-tooltip-value">' + value + '</div>';
self.showTooltipOther(absoluteTime, relativeTime, group, pos); self.showTooltip(absoluteTime, relativeTime, group, pos);
} }
// no hit // no hit
else { else {
......
...@@ -52,10 +52,6 @@ ...@@ -52,10 +52,6 @@
text="All series" model="panel.tooltip.shared" change="render()" 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"> tip="Show all series on same tooltip and a x croshair to help follow all series">
</editor-opt-bool> </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"> <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> <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> <select class="input-small" ng-model="panel.tooltip.value_type" ng-options="f for f in ['cumulative','individual']" ng-change="render()"></select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment