Superb, the only extra thing i needed to add was the seconds to millisecond 
conversion, which i actually did in the php which spits out the formatted 
array.

On Thursday, January 31, 2013 6:36:03 PM UTC, asgallant wrote:
>
> You need to use a "date" type column in the DataTable, passing in Date 
> objects, and you need to format both the DataTable column and the hAxis in 
> the desired format.  To use a Date column, you cannot use the 
> arrayToDataTable method, you'll have to construct the DataTable manually:
>
> var data = new google.visualization.DataTable();
> data.addColumn('datetime', 'Date');
> data.addColumn('number', 'Height');
>
> data.addRows([
>     [new Date(1359599700), 5.53],
>     // ...
> ]);
>
> // use a DateFormat on the DataTable:
> var formatter = new google.visualization.DateFormat({pattern: 'HH:mm'});
> formatter.format(data, 0);
>
> On Thursday, January 31, 2013 1:15:26 PM UTC-5, Jim Thompson wrote:
>>
>> I am drawing a line chart and I am passing epoch time in the data array, 
>> however i want to display the time as HH:mm on both the hAxis and tooltip.
>>
>> My cod ebelow doesn't work, where am i going wrong?
>>
>> google.load("visualization", "1", {
>>     packages: ["corechart"]
>> });
>> google.setOnLoadCallback(drawChart);
>>
>> function drawChart() {
>>
>>     var data = google.visualization.arrayToDataTable([
>>         ['Date', 'Height'],
>>         [1359599700, 5.53],
>>         [1359623460, 0.32],
>>         [1359644700, 5.50],
>>         [1359666600, 0.65],
>>         [1359688320, 5.48],
>>         [1359711960, 0.44],
>>         [1359733440, 5.39],
>>         [1359754980, 0.74]
>>     ]);
>>     var options = {
>>         vAxis: {
>>             title: null,
>>             format: '#m'
>>         },
>>         hAxis: {
>>             format: 'HH:mm'
>>         },
>>         legend: 'none',
>>         lineWidth: 3,
>>         curveType: 'function',
>>         smoothLine: true,
>>         colors: ['b60000'],
>>         chartArea: {
>>             'width': '360',
>>             'height': '100'
>>         },
>>     };
>>
>>     var chart = new 
>> google.visualization.LineChart(document.getElementById('tideChart'));
>>     chart.draw(data, options);
>> }
>>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to