Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Charts API - Column patterns and "TimeOfDay" data type

I'm working with the Google Charts API to create a graph of a student's test-taking performance. On the X axis, the graph shows the days of the week. On the Y axis, the graph shows how long the student spent taking the exam. (The goal is for teachers to see if the student speeds up). However, I have a problem:

My data is in the timeofday format, and I'm providing values to the chart as time durations using the Google Charts [HH,MM,SS,MSEC] format. When the chart renders, the Y axis is printed as "HH:MM:SS". I'd really like to customize that because the seconds are pretty useless and it looks messier than I'd like.

The Charts API says you can specify a "pattern" for a column, and I've specified "HH:MM". However, that doesn't seem to take effect at all. Anybody have experience formatting timeofday in Google Charts and know how to do this?

like image 335
Ben Gotow Avatar asked Dec 13 '11 22:12

Ben Gotow


1 Answers

The format is buried deep in the API documentation. (http://code.google.com/apis/chart/interactive/docs/reference.html). It is about quarter way down, it says:

If the column type is 'timeofday', the value is an array of four numbers: [hour, minute, second, milliseconds].

like image 188
Distec Avatar answered Nov 08 '22 20:11

Distec