I resolved it this way:
                    for (var i = 0; i < data.length; i++) {
                        var date = new 
Date(parseInt(data[i].Date.substr(6)));
                        tdata.addRow([data[i].Id, date, data[i].Opens]);
                    }

On Thursday, 11 July 2013 10:50:59 UTC+2, 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.


Reply via email to