The format of the vertical axis of a Google Visualization Chart can be changed like this:
options['vAxis'] = {'format': "#,###'%'"};
But I want to format my axis labels in a more complex way that requires to apply some operations to the number.
In my particular case my labels would represent time (in seconds), and I want to show them in minutes and seconds, i.e, ‘Xmin Ysecs’.
Please take into account that the google.visualization.*formatter_name* methods only change the format of the value in the tooltip, not in the axis labels.
Does any one knows how to do it?
Thanks.
Google uses subset of ICU format, here is the ICU page where they tell how to format dates and time:
http://userguide.icu-project.org/formatparse/datetime
your variable should be in datetime format, here is the example:
http://code.google.com/apis/chart/interactive/docs/gallery/annotatedtimeline.html#Data_Format
just specify your date format
dateFormat
string Either ‘MMMM dd, yyyy’ or ‘HH:mm MMMM dd, yyyy’, depending on the type of the first column (date, or datetime, respectively).
The format used to display the date information in the top right corner. The format of this field is as specified by the java SimpleDateFormat class.
So, for showing time you would need something like ‘HH:mm:ss’