Numeral.js custom format


#1

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?


(Mark Walkom) #2

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


#3

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.


(Mark Walkom) #4

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


#5

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


(Tanya Bragin) #6

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


#7

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


(Tanya Bragin) #8

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?


#9

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.


(Tanya Bragin) #10

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


#11

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?


(Mark Walkom) #12

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


(Domenico Rella) #13

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


(system) #14