+
+ {{panelMeta.timeInfo}}
+
+
No datapoints No datapoints returned from metric query
diff --git a/src/app/panels/graph/module.js b/src/app/panels/graph/module.js
index 7fde36b475f..eac410360ad 100644
--- a/src/app/panels/graph/module.js
+++ b/src/app/panels/graph/module.js
@@ -26,6 +26,7 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
$scope.panelMeta.addEditorTab('Axes & Grid', 'app/panels/graph/axisEditor.html');
$scope.panelMeta.addEditorTab('Display Styles', 'app/panels/graph/styleEditor.html');
+ $scope.panelMeta.addEditorTab('Time range', 'app/features/dashboard/partials/panelTime.html');
$scope.panelMeta.addExtendedMenuItem('Export CSV', '', 'exportCsv()');
$scope.panelMeta.addExtendedMenuItem('Toggle legend', '', 'toggleLegend()');
@@ -88,6 +89,9 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
value_type: 'cumulative',
shared: false,
},
+ // time overrides
+ timeFrom: null,
+ timeShift: null,
// metric queries
targets: [{}],
// series color overrides
@@ -114,6 +118,25 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
$scope.updateTimeRange = function () {
$scope.range = timeSrv.timeRange();
$scope.rangeUnparsed = timeSrv.timeRange(false);
+
+ $scope.panelMeta.timeInfo = "";
+
+ // check panel time overrrides
+ if ($scope.panel.timeFrom) {
+ if (_.isString($scope.rangeUnparsed.from)) {
+ $scope.panelMeta.timeInfo = "Last " + $scope.panel.timeFrom;
+ $scope.rangeUnparsed.from = 'now-' + $scope.panel.timeFrom;
+ $scope.range.from = kbn.parseDate($scope.rangeUnparsed.from);
+ }
+ }
+ // if ($scope.panel.timeShift) {
+ // // from: now-1h
+ // // to: now
+ // // timeshift: 1d
+ // // from: now-1d-1h
+ // // to: now-1d
+ // }
+
if ($scope.panel.maxDataPoints) {
$scope.resolution = $scope.panel.maxDataPoints;
}
diff --git a/src/css/less/graph.less b/src/css/less/graph.less
index 5ad38283689..46263a43988 100644
--- a/src/css/less/graph.less
+++ b/src/css/less/graph.less
@@ -141,7 +141,7 @@
vertical-align: top;
position: relative;
left: 4px;
- top: -20px;
+ top: -25px;
}
.graph-legend {
@@ -260,7 +260,6 @@
transform-origin: right top;
}
-
.axisLabel {
color: @textColor;
font-size: @fontSizeSmall;
@@ -269,3 +268,13 @@
font-size: 12px;
}
+.graph-time-info {
+ font-weight: bold;
+ float: right;
+ margin-right: 15px;
+ color: @blue;
+ font-size: 85%;
+ position: relative;
+ top: -20px;
+}
+
diff --git a/src/css/less/panel.less b/src/css/less/panel.less
index 7a9a8aba4ff..451431b9d76 100644
--- a/src/css/less/panel.less
+++ b/src/css/less/panel.less
@@ -49,8 +49,8 @@
.panel-loading {
position:absolute;
- top: 0px;
- right: 4px;
+ top: -3px;
+ right: 0px;
z-index: 800;
}