mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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 #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 #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 #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**
|
**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).
|
- [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 = [];
|
data.flotpairs = [];
|
||||||
|
|
||||||
if ($scope.series && $scope.series.length > 0) {
|
if ($scope.series && $scope.series.length > 0) {
|
||||||
|
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.value = $scope.series[0].stats[$scope.panel.valueName];
|
||||||
data.flotpairs = $scope.series[0].flotpairs;
|
data.flotpairs = $scope.series[0].flotpairs;
|
||||||
}
|
|
||||||
|
|
||||||
var decimalInfo = $scope.getDecimalsForValue(data.value);
|
var decimalInfo = $scope.getDecimalsForValue(data.value);
|
||||||
var formatFunc = kbn.valueFormats[$scope.panel.format];
|
var formatFunc = kbn.valueFormats[$scope.panel.format];
|
||||||
data.valueFormated = formatFunc(data.value, decimalInfo.decimals, decimalInfo.scaledDecimals);
|
data.valueFormated = formatFunc(data.value, decimalInfo.decimals, decimalInfo.scaledDecimals);
|
||||||
data.valueRounded = kbn.roundValue(data.value, decimalInfo.decimals);
|
data.valueRounded = kbn.roundValue(data.value, decimalInfo.decimals);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check value to text mappings
|
// check value to text mappings
|
||||||
for(var i = 0; i < $scope.panel.valueMaps.length; i++) {
|
for(var i = 0; i < $scope.panel.valueMaps.length; i++) {
|
||||||
|
@ -41,9 +41,11 @@ function (_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var datapoints = [];
|
var datapoints = [];
|
||||||
|
if (series.values) {
|
||||||
for (i = 0; i < series.values.length; i++) {
|
for (i = 0; i < series.values.length; i++) {
|
||||||
datapoints[i] = [series.values[i][j], series.values[i][0]];
|
datapoints[i] = [series.values[i][j], series.values[i][0]];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
output.push({ target: seriesName, datapoints: datapoints});
|
output.push({ target: seriesName, datapoints: datapoints});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user