Question

I am using Google Visualization and am wondering how I can force two decimal digits in the axis labels.

vAxes:[
     {title:'Click-through-Rate', format:'#,###.####%'}, // Axis 1
     {title:'Cost-per-Click (CHF)', format:'CHF #,###.##'}, // Axis 2
],

The labels for axis 2 still show as CHF 0.3.

On a side note: What does ',' actually separate?

I already read through http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details however this documentation really doesn't help me at all in understanding how ICU patterns work.

All the best and thanks

Mario

Was it helpful?

Solution

Use 0 to indicate that the formatter should use placeholder 0's: eg. 'CHF #,###.00' formats 0.3 as 'CHF 0.30'.

The , tells the formatter how to handle large number groupings. The ICU pattern recognizes two uses of the ,: the first instance to the left of the decimal separator (.) is used for the smallest grouping. If there is a second , to the left of the first, that is used to separate large groupings. If only one is present, it is used for all groupings. Examples:

'#,###'    formats 12345 as '12,345' and 123456789 as '123,456,789'
'#,##,###' formats 12345 as '12,345' and 123456789 as '12,34,56,789'
'#,###,##' formats 12345 as '123,45' and 123456789 as '1,234,567,89'

The actual separator character used depends on locale (so '123,456,789' might be '123.456.789' in some European formats).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top