Thanks for the reply.
Shouldn't one may be specify the column to format in the monthYear
formatter?
And should the data type specified, when adding the column, be 'string' or
'date'?
On Thursday, 11 July 2013 18:55:16 UTC+2, asgallant wrote:
>
> Your monthYear formatter looks correct. Are the dates being displayed
> literally as "/Date(1372761341103)/"? If so, then there is a problem in
> your JSON. Post a sample of the JSON and I will take a look.
>
> On Thursday, July 11, 2013 4:50:59 AM UTC-4, Andre van Schaik wrote:
>>
>> Hi
>>
>> I am returning data to the chart using JSON.
>> I've managed to format the date for the x-axiz of the Line Chart etc.
>>
>> But I need help doing the same for a Table Chart where one of the columns
>> should be of date format.
>> At the moment it is displaying "/Date(1372761341103)/"
>>
>> How do I format this column?
>>
>> * * function drawChart3() {
>> $.get('/MyMall/GetAdRunData', {},
>> function (data) {
>>
>> /* Add data */
>> var tdata = new google.visualization.DataTable()
>> tdata.addColumn('number', 'Id');
>> tdata.addColumn('date','Date');
>> tdata.addColumn('number', 'Opens');
>>
>> for (var i = 0; i < data.length; i++) {
>> tdata.addRow([data[i].Id, data[i].Date,
>> data[i].Opens]);
>> }
>>
>> /* Draw chart */
>> var chart = new
>> google.visualization.Table(document.getElementById('chart_adRun'));
>> //var formatter = new
>> google.visualization.ColorFormat();
>> //var monthYearFormatter = new
>> google.visualization.DateFormat({ pattern: "MMM yyyy" });
>> monthYearFormatter.format(tdata, 0);
>> formatter.addRange(-1, 1, 'white', 'orange');
>> formatter.addRange(0, 2, 'red', '#33ff33');
>> formatter.addRange(1, 10, 'red', 'pink');
>> formatter.format(tdata, 1); // Apply formatter to
>> second column
>> chart.draw(tdata, { allowHtml: true, showRowNumber:
>> false });
>> }
>> )
>> }
>>
>
--
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.
For more options, visit https://groups.google.com/groups/opt_out.