From c43f2bbb86d75ebb7f0ac4900d005e2ffce6f828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 7 Aug 2015 10:01:34 +0200 Subject: [PATCH] fix(singlestat): fix to handle series with no data points, fixes #2460 --- CHANGELOG.md | 1 + public/app/panels/singlestat/module.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50d421782cc..e60094d9ace 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - [Issue #2443](https://github.com/grafana/grafana/issues/2443). Templating: Fix for buggy repeat row behavior when combined with with repeat panel due to recent change before 2.1 release - [Issue #2442](https://github.com/grafana/grafana/issues/2442). Templating: Fix text panel when using template variables in text in in repeated panel - [Issue #2446](https://github.com/grafana/grafana/issues/2446). InfluxDB: Fix for using template vars inside alias field (InfluxDB 0.9) +- [Issue #2460](https://github.com/grafana/grafana/issues/2460). SinglestatPanel: Fix to handle series with no data points # 2.1.0 (2015-08-04) diff --git a/public/app/panels/singlestat/module.js b/public/app/panels/singlestat/module.js index b38912605bb..e4aeb19071b 100644 --- a/public/app/panels/singlestat/module.js +++ b/public/app/panels/singlestat/module.js @@ -186,7 +186,9 @@ function (angular, app, _, TimeSeries, kbn, PanelMeta) { data.flotpairs = []; if ($scope.series && $scope.series.length > 0) { - var lastValue = _.last($scope.series[0].datapoints)[0]; + var lastPoint = _.last($scope.series[0].datapoints); + var lastValue = _.isArray(lastPoint) ? lastPoint[0] : null; + if (_.isString(lastValue)) { data.value = 0; data.valueFormated = lastValue;