You have to format the timeofday column.  There are no built-in formatters 
for the timeofday data type, but you can hijack the DateFormatter for the 
purpose:

var formatter = new google.visualization.DateFormat({pattern: 'h:mm a'});
var timeSteps = ['hours', 'minutes', 'seconds', 'milliseconds'];
for (var i = 0; i < data.getNumberOfRows(); i++) {
    var timeofday = data.getValue(i, 0);
    var date = new Date(0);
    for (var j = 0; j < timeofday.length; j++) {
        switch (timeSteps[j]) {
            case 'hours':
                date.setHours(timeofday[j]);
                break;
            case 'minutes':
                date.setMinutes(timeofday[j]);
                break;
            case 'seconds':
                date.setSeconds(timeofday[j]);
                break;
            case 'milliseconds':
                date.setMilliseconds(timeofday[j]);
                break;
        }
    }
    var formattedTime = formatter.formatValue(date);
    data.setFormattedValue(i, 0, formattedTime);
}



On Wednesday, August 20, 2014 5:06:47 PM UTC-4, Neil Camara wrote:
>
> I got it working. However, one last thing I need to fix are the hour 
> values in the tool tip. It's showing military time. The hour values though 
> in the axis are displayed correctly.
>
> Here is a screenshot where I clicked one of the points. it's showing 19:00 
> rather than 7pm.
>
> http://i.imgur.com/v75lIbq.png
>
>
> On Wednesday, August 20, 2014 3:28:00 PM UTC-5, Neil Camara wrote:
>>
>> Hi Andrew,
>>
>> What's wrong with my ticks?
>>
>>         hAxis: {
>>             format:'h:mm aa',
>>             ticks: [
>>                 [0, 0, 0, 0], [1, 0, 0, 0], [2, 0, 0, 0], [3, 0, 0, 0], 
>> [4, 0, 0, 0], [5, 0, 0, 0], [6, 0, 0, 0], [7, 0, 0, 0], [8, 0, 0, 0], [9, 
>> 0, 0, 0], [10, 0, 0, 0], [11, 0, 0, 0], [12, 0, 0, 0],
>>                 [13, 0, 0, 0], [14, 0, 0, 0], [15, 0, 0, 0], [16, 0, 0, 
>> 0], [17, 0, 0, 0], [18, 0, 0, 0], [19, 0, 0, 0], [20, 0, 0, 0], [21, 0, 0, 
>> 0], [22, 0, 0, 0], [23, 0, 0, 0]
>>             ]
>> //            "gridlines": {
>> //                "count": 24
>> //            }
>>         },
>>
>> graph is failing now
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to