DataTable - right justifying numbers with 3 digits decimal places and commas

625 views
Skip to first unread message

Bharat

unread,
Aug 25, 2011, 1:13:10 PM8/25/11
to Google Visualization API
I am using the DataTable to display data in my application. I need to
display numbers in the following format:

1. Right aligned
2. With three digits precision after the decimal point
3. With a "," as dilimiter for thousands.

I can do all this in Ruby but when I send the formatted number over,
Javascript gets upset and complains "0.000" is not an integer or
float.

Is there an easy way to do this in Visualization?

Thanks.

Bharat

asgallant

unread,
Aug 25, 2011, 1:22:33 PM8/25/11
to google-visua...@googlegroups.com
Use the numberFormatter: http://code.google.com/apis/chart/interactive/docs/reference.html#numberformatter

I think tables right-align numbers automatically, but if they don't, you can set a CSS class for each cell in the column and then set the alignment with styles.

Bharat

unread,
Aug 25, 2011, 1:31:14 PM8/25/11
to Google Visualization API
Reply all
Reply to author
Forward
0 new messages