The DataTable constructor can accept a fully standard JSON object, which
means the data values need to be inside quotes, and with the "new" word.
E.g,  {v: "Date(2010, 1, 28, 0, 31, 26)"}. It can also accept a more
"object-like" object where there's a real Date instance there, so it goes
without the quotes, and with the "new" keyword.

HTH

On Fri, Sep 3, 2010 at 7:43 AM, cilerler <[email protected]> wrote:

> Is there a way to create a DataTable from WebService provided JSON
> with Date field?
> In samples I saw => new Date(2010,1,28,0,31,26)
> but it retrieves data with quotes like => "new Date(2010, 1, 28, 0,
> 31, 26)"
> which doesn't work.
>
> what can it be as workaround?
>
> thank you for your time and attention...
>
> ----
> function drawVisualization() {
>  // Create and populate the data table.
>  var JSONObject = {
>  cols: [{id: 'A', label: 'NEW A', type: 'string'},
>         {id: 'B', label: 'B-label', type: 'number'},
>         {id: 'C', label: 'C-label', type: 'date'}
>        ],
>  rows: [{c:[{v: 'a'}, {v: 1.0, f: 'One'}, {v: "new Date(2010, 1, 28,
> 0, 31, 26)"}]},
>         {c:[{v: 'b'}, {v: 2.0, f: 'Two'}, {v: new Date(2010, 2, 30,
> 0, 31, 26)}]},
>         {c:[{v: 'c'}, {v: 3.0, f: 'Three'}, {v: new Date(2010, 3, 30,
> 0, 31, 26)}]}
>        ]
>  };
>
>  var data = new google.visualization.DataTable(JSONObject, 0.5);
>
>  // Create and draw the visualization.
>  visualization = new
> google.visualization.Table(document.getElementById('table'));
>  visualization.draw(data, {'allowHtml': true});
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-visualization-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to