add locale format

This commit is contained in:
Andrew Prokhorenkov 2017-09-15 10:30:28 +03:00 committed by Carl Bergquist
parent 114ba801b9
commit 8cdf12b694

View File

@ -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' },
]
},
{