Commit 0bb80aeb by Rashid Khan

Added interval selector to histogram

parent 75568583
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
.histogram-options label { .histogram-options label {
margin: 0px 0px 0px 10px !important; margin: 0px 0px 0px 10px !important;
} }
.histogram-options span {
white-space: nowrap;
}
</style> </style>
<div> <div>
<span ng-show='panel.options'> <span ng-show='panel.options'>
...@@ -50,6 +53,9 @@ ...@@ -50,6 +53,9 @@
<label style="white-space:nowrap" class="small">Percent</label> <label style="white-space:nowrap" class="small">Percent</label>
<input type="checkbox" ng-model="panel.percentage" ng-checked="panel.percentage" ng-change="render()"> <input type="checkbox" ng-model="panel.percentage" ng-checked="panel.percentage" ng-change="render()">
</span> </span>
<span>
<label class="small">Interval</label> <select ng-change="set_interval(panel.interval);get_data();" class="input-small" ng-model="panel.interval" ng-options="interval_label(time) for time in _.union([panel.interval],['auto','1s','1m','5m','10m','30m','1h','3h','12h','1d','1w','1M','1y'])"></select>
</span>
</form> </form>
<center><img ng-show='panel.loading && _.isUndefined(data)' src="img/load_big.gif"></center> <center><img ng-show='panel.loading && _.isUndefined(data)' src="img/load_big.gif"></center>
<div histogram-chart class="pointer histogram-chart" params="{{panel}}"></div> <div histogram-chart class="pointer histogram-chart" params="{{panel}}"></div>
......
...@@ -118,6 +118,19 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -118,6 +118,19 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
}; };
$scope.set_interval = function(interval) {
if(interval !== 'auto') {
$scope.panel.auto_int = false;
$scope.panel.interval = interval;
} else {
$scope.panel.auto_int = true;
}
};
$scope.interval_label = function(interval) {
return $scope.panel.auto_int && interval === $scope.panel.interval ? interval+" (auto)" : interval;
};
/** /**
* The time range effecting the panel * The time range effecting the panel
* @return {[type]} [description] * @return {[type]} [description]
......
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