Numeral.js custom format

hi guys.

I am trying to figure out this Numeral.js. I want a "." as thousand operator and a "," to round numbers off.

Example of my number field: 100000. I want that to look like 1.000,00.

Possible?

You can do that in the advanced settings part of KB, but be careful!

Okay but where? All I see in advanced is "format:number:defaultPattern " - but that seems like a global version of what I can set per field, and nothing more.

If you want to do that for a specific field, head to the index pattern settings and then edit that field.

Let me rephrase: What should the Numeral.js format pattern look like to achieve this?

It doesn't appear to be possible using Numeral.js, it assumes that period stands for beginning of the decimal points: http://numeraljs.com/

Hmm okay. Can i divide by 100, so I would end up with 1000,00?

Yes, you can divide the number by 100 using scripted fields. However, it still won't result in formatting you're looking for, with a decimal point being a comma.

Just so I understand what you are trying to do - are you trying to format a number in a locale-specific format for a specific country, where the decimal point is represented by a comma and a thousand point is represented by a dot?

Yes that is what I am trying to do - in Denmark we use dot as thousand separator. But I am also trying to divide by 100 since the field is represented in cents, and I want it represented in "$,cents". So the raw 100000 is actually 1000$ and 00 cents, represented in Danish like 1.000,00.

Sorry about the delay in the response. I think this is an enhancement request - we should allow this sort of configuration in field formatters, which we don't today. Would you mind filing it here? https://github.com/elastic/kibana/issues

No worries. I have submitted an issue now.

I was thinking about a different approach to dividing my "amount" by 100. Is there a logstash filter-plugin, that can do math?

1 Like

Not directly, you can do it with the ruby plugin and a bit of code though.

Hello, at the moment with version 5 of kibana, is possible to change the number format, using the "," for the decimals?
Thanks

5 Likes