Axis format

17 views
Skip to first unread message

Denzo

unread,
Nov 3, 2011, 7:57:37 PM11/3/11
to Google Visualization API
Is there a way to have a formating function for the numbers displayed
on the axis. For instance, instead of displaying 5000000 I want to
display 5M.

asgallant

unread,
Nov 4, 2011, 8:29:26 AM11/4/11
to google-visua...@googlegroups.com
I don't believe there is any way to do this in the API (the only formatting I know of that you can do with axis values is ICU patterns).  There may be a way to hack around it by modifying the chart's SVG, but that may not be reliable.

NP

unread,
Nov 8, 2011, 1:08:11 AM11/8/11
to Google Visualization API
There is pattern formatting - http://code.google.com/apis/chart/interactive/docs/reference.html#patternformatter
See if you can manipulate it to use regex so that it can recognize a
pattern and do a substitution for example if 5000000, then replace the
zeros with M, if 5000 replace the 0's with K

asgallant

unread,
Nov 8, 2011, 9:14:07 AM11/8/11
to google-visua...@googlegroups.com
That only works on data values, not the axis.
Reply all
Reply to author
Forward
0 new messages