mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
feat(singlestat): Added support for string values, Closes #2203
This commit is contained in:
parent
68a45608e6
commit
11170dd34c
@ -8,6 +8,7 @@
|
||||
- [Issue #590](https://github.com/grafana/grafana/issues/590). Graph: Define series color using regex rule
|
||||
- [Issue #2162](https://github.com/grafana/grafana/issues/2162). Graph: New series style override, negative-y transform and stack groups
|
||||
- [Issue #2096](https://github.com/grafana/grafana/issues/2096). Dashboard list panel: Now supports search by multiple tags
|
||||
- [Issue #2203](https://github.com/grafana/grafana/issues/2203). Singlestat: Now support string values
|
||||
|
||||
**User or Organization admin**
|
||||
- [Issue #1899](https://github.com/grafana/grafana/issues/1899). Organization: You can now update the organization user role directly (without removing and readding the organization user).
|
||||
|
@ -186,14 +186,21 @@ function (angular, app, _, TimeSeries, kbn, PanelMeta) {
|
||||
data.flotpairs = [];
|
||||
|
||||
if ($scope.series && $scope.series.length > 0) {
|
||||
data.value = $scope.series[0].stats[$scope.panel.valueName];
|
||||
data.flotpairs = $scope.series[0].flotpairs;
|
||||
}
|
||||
var lastValue = _.last($scope.series[0].datapoints)[0];
|
||||
if (_.isString(lastValue)) {
|
||||
data.value = 0;
|
||||
data.valueFormated = lastValue;
|
||||
data.valueRounded = 0;
|
||||
} else {
|
||||
data.value = $scope.series[0].stats[$scope.panel.valueName];
|
||||
data.flotpairs = $scope.series[0].flotpairs;
|
||||
|
||||
var decimalInfo = $scope.getDecimalsForValue(data.value);
|
||||
var formatFunc = kbn.valueFormats[$scope.panel.format];
|
||||
data.valueFormated = formatFunc(data.value, decimalInfo.decimals, decimalInfo.scaledDecimals);
|
||||
data.valueRounded = kbn.roundValue(data.value, decimalInfo.decimals);
|
||||
var decimalInfo = $scope.getDecimalsForValue(data.value);
|
||||
var formatFunc = kbn.valueFormats[$scope.panel.format];
|
||||
data.valueFormated = formatFunc(data.value, decimalInfo.decimals, decimalInfo.scaledDecimals);
|
||||
data.valueRounded = kbn.roundValue(data.value, decimalInfo.decimals);
|
||||
}
|
||||
}
|
||||
|
||||
// check value to text mappings
|
||||
for(var i = 0; i < $scope.panel.valueMaps.length; i++) {
|
||||
|
@ -41,8 +41,10 @@ function (_) {
|
||||
}
|
||||
|
||||
var datapoints = [];
|
||||
for (i = 0; i < series.values.length; i++) {
|
||||
datapoints[i] = [series.values[i][j], series.values[i][0]];
|
||||
if (series.values) {
|
||||
for (i = 0; i < series.values.length; i++) {
|
||||
datapoints[i] = [series.values[i][j], series.values[i][0]];
|
||||
}
|
||||
}
|
||||
|
||||
output.push({ target: seriesName, datapoints: datapoints});
|
||||
|
Loading…
Reference in New Issue
Block a user