From 8cdf12b6946fce900ebc9d0f1e813426a094a1f5 Mon Sep 17 00:00:00 2001 From: Andrew Prokhorenkov Date: Fri, 15 Sep 2017 10:30:28 +0300 Subject: [PATCH] add locale format --- public/app/core/utils/kbn.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/app/core/utils/kbn.js b/public/app/core/utils/kbn.js index 648bfdbd4d9..882ce9993f0 100644 --- a/public/app/core/utils/kbn.js +++ b/public/app/core/utils/kbn.js @@ -389,6 +389,10 @@ function($, _) { return value.toExponential(decimals); }; + kbn.valueFormats.locale = function(value, decimals) { + return value.toLocaleString(undefined, {maximumFractionDigits: decimals}); + }; + // Currencies kbn.valueFormats.currencyUSD = kbn.formatBuilders.currency('$'); kbn.valueFormats.currencyGBP = kbn.formatBuilders.currency('£'); @@ -709,6 +713,7 @@ function($, _) { {text: 'hexadecimal (0x)', value: 'hex0x' }, {text: 'hexadecimal', value: 'hex' }, {text: 'scientific notation', value: 'sci' }, + {text: 'locale format', value: 'locale' }, ] }, {