diff --git a/src/app/directives/grafanaGraph.js b/src/app/directives/grafanaGraph.js index 0678ffcc91f..6d6c6ae3148 100644 --- a/src/app/directives/grafanaGraph.js +++ b/src/app/directives/grafanaGraph.js @@ -260,13 +260,13 @@ function (angular, $, kbn, moment, _) { return "%Y-%m"; } if(_int >= 10000) { - return "%Y-%m-%d"; + return "%m/%d"; } if(_int >= 3600) { - return "%m/%d %H:%M" //"%H:%M
%m-%d"; + return "%m/%d %H:%M"; } if(_int >= 700) { - return "%a %H:%M" //"%H:%M
%m-%d"; + return "%a %H:%M"; } return "%H:%M"; diff --git a/src/app/panels/graphite/axisEditor.html b/src/app/panels/graphite/axisEditor.html index ccb62b551d6..e2b1460f002 100644 --- a/src/app/panels/graphite/axisEditor.html +++ b/src/app/panels/graphite/axisEditor.html @@ -48,8 +48,35 @@
Legend
- + +
+
+
+
+
Legend values
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ \ No newline at end of file diff --git a/src/app/panels/graphite/legend.html b/src/app/panels/graphite/legend.html index ab95477b112..7e42d38226a 100644 --- a/src/app/panels/graphite/legend.html +++ b/src/app/panels/graphite/legend.html @@ -1,4 +1,4 @@ - @@ -9,8 +9,25 @@ - {{series.alias}} [max: {{series.max}}, min: {{series.min}}, total: {{series.total}}, avg: {{series.avg}}, current: {{series.current}}] + {{series.alias}} + + +   Current: {{series.current}}  + + +   Min: {{series.min}}  + + +   Max: {{series.max}}  + + +   Total: {{series.total}}  + + +   Avg: {{series.avg}}  + + diff --git a/src/app/panels/graphite/module.js b/src/app/panels/graphite/module.js index e4193d532db..c998e9745ef 100644 --- a/src/app/panels/graphite/module.js +++ b/src/app/panels/graphite/module.js @@ -153,7 +153,15 @@ function (angular, app, $, _, kbn, moment, timeSeries) { /** @scratch /panels/histogram/3 * legend:: Display the legond */ - legend : true, + legend: { + show: true, // disable/enable legend + values: false, // disable/enable legend values + min: false, + max: false, + current: false, + total: false, + avg: false + }, /** @scratch /panels/histogram/3 * ==== Transformations /** @scratch /panels/histogram/3 @@ -182,11 +190,16 @@ function (angular, app, $, _, kbn, moment, timeSeries) { }; _.defaults($scope.panel,_d); - _.defaults($scope.panel.tooltip,_d.tooltip); - _.defaults($scope.panel.annotate,_d.annotate); - _.defaults($scope.panel.grid,_d.grid); + _.defaults($scope.panel.tooltip, _d.tooltip); + _.defaults($scope.panel.annotate, _d.annotate); + _.defaults($scope.panel.grid, _d.grid); // backward compatible stuff + if (_.isBoolean($scope.panel.legend)) { + $scope.panel.legend = { show: $scope.panel.legend }; + _.defaults($scope.panel.legend, _d.legend); + } + if ($scope.panel.y_format) { $scope.panel.y_formats[0] = $scope.panel.y_format; delete $scope.panel.y_format; diff --git a/src/app/panels/graphite/timeSeries.js b/src/app/panels/graphite/timeSeries.js index 02907b406ce..c9623de267a 100644 --- a/src/app/panels/graphite/timeSeries.js +++ b/src/app/panels/graphite/timeSeries.js @@ -48,8 +48,10 @@ function (_) { result.push([currentTime * 1000, currentValue]); }, this); - this.info.avg = this.info.total / result.length; - this.info.current = result[result.length-1][1]; + if (result.length) { + this.info.avg = (this.info.total / result.length).toFixed(2); + this.info.current = result[result.length-1][1]; + } return result; };