From 24d68008fa5da76d74b8ec842a034b70e886bd71 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Thu, 15 Aug 2019 15:54:32 +0300 Subject: [PATCH] Format target value as a number with reasonable default (#4073) --- client/app/visualizations/counter/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/app/visualizations/counter/index.js b/client/app/visualizations/counter/index.js index d2577ba31..2ece76b2b 100644 --- a/client/app/visualizations/counter/index.js +++ b/client/app/visualizations/counter/index.js @@ -145,8 +145,13 @@ const CounterRenderer = { $scope.targetValueTooltip = formatTooltip($scope.targetValue, options.tooltipFormat); $scope.counterValue = formatValue($scope.counterValue, options); + if (options.formatTargetValue) { $scope.targetValue = formatValue($scope.targetValue, options); + } else { + if (Number.isFinite($scope.targetValue)) { + $scope.targetValue = numeral($scope.targetValue).format('0[.]00[0]'); + } } }