google vizualization wrong number format

134 views Asked by At

I'm trying to format a number with thousands separator and decimal separator. In google api documentation says that by default, thousands separator is "," while decimal separator is ".", but I have to inverted to get the desire results results.

I mean, by defautl when I create a chart I get numbers like 3,50 instaed of 3.50 if I want the dot, I need a formatter with a comma decimal separator.

var formatter = new google.visualization.NumberFormat({pattern: "#,00"});

this give 3.50

var formatter = new google.visualization.NumberFormat({pattern: "#.00"});

this give 3,50

even the examples at developers.google.com are shown wrong.

My computer region is Dominican Republic, es-DO language.

can you tell me what is wrong?

1

There are 1 answers

0
Henrik Aronsson On

Refer to the google charts documentation for this information.

I would use

var formatter = new google.visualization.NumberFormat({
  decimalSymbol: '.',
  groupingSymbol: ','
});

This will give you "." as decimal and it would use "," as thousand separator.