improvement to bar width
This commit is contained in:
@@ -75,9 +75,6 @@ function (angular, $, kbn, moment, _) {
|
||||
}
|
||||
});
|
||||
|
||||
// Set barwidth based on specified interval
|
||||
var barwidth = kbn.interval_to_ms(scope.interval);
|
||||
|
||||
var stack = panel.stack ? true : null;
|
||||
|
||||
// Populate element
|
||||
@@ -96,7 +93,7 @@ function (angular, $, kbn, moment, _) {
|
||||
bars: {
|
||||
show: panel.bars,
|
||||
fill: 1,
|
||||
barWidth: barwidth/1.5,
|
||||
barWidth: 1,
|
||||
zero: false,
|
||||
lineWidth: 0
|
||||
},
|
||||
@@ -128,6 +125,10 @@ function (angular, $, kbn, moment, _) {
|
||||
data[i].data = _d;
|
||||
}
|
||||
|
||||
if (panel.bars && data.length && data[0].info.timeStep) {
|
||||
options.series.bars.barWidth = data[0].info.timeStep / 1.5;
|
||||
}
|
||||
|
||||
addTimeAxis(options);
|
||||
addGridThresholds(options, panel);
|
||||
addAnnotations(options);
|
||||
|
||||
@@ -213,6 +213,12 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
|
||||
$scope.setDatasource = function(datasource) {
|
||||
$scope.panel.datasource = datasource;
|
||||
$scope.datasource = datasourceSrv.get(datasource);
|
||||
|
||||
if (!$scope.datasource) {
|
||||
$scope.panel.error = "Cannot find datasource " + datasource;
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.get_data();
|
||||
};
|
||||
|
||||
|
||||
@@ -50,7 +50,12 @@ function (_, kbn) {
|
||||
result.push([currentTime * 1000, currentValue]);
|
||||
}, this);
|
||||
|
||||
if (result.length > 2) {
|
||||
this.info.timeStep = result[1][0] - result[0][0];
|
||||
}
|
||||
|
||||
if (result.length) {
|
||||
|
||||
this.info.avg = (this.info.total / result.length);
|
||||
this.info.current = result[result.length-1][1];
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
<button class="btn btn-success pull-right" ng-click="add_target(panel.target)">Add query</button>
|
||||
|
||||
<div class="btn-group pull-right" style="margin-right: 10px;">
|
||||
<button class="btn btn-info dropdown-toggle" data-toggle="dropdown">DS {{datasource.name}} <span class="caret"></span></button>
|
||||
<button class="btn btn-info dropdown-toggle" data-toggle="dropdown" bs-tooltip="'Datasource'">{{datasource.name}} <span class="caret"></span></button>
|
||||
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li ng-repeat="datasource in datasources" role="menuitem">
|
||||
<a ng-click="setDatasource(datasource.value);">{{datasource.name}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -20,6 +20,9 @@ function (angular, _, config) {
|
||||
if (!name) { return this.default; }
|
||||
|
||||
var ds = config.datasources[name];
|
||||
if (!ds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch(ds.type) {
|
||||
case 'graphite':
|
||||
|
||||
Reference in New Issue
Block a user