So my data passed to the DataTable should look something like:
{"cols":[{"label":"dated","type":"date"},{"label":"price"
,"type":"number"}],"rows":[{"c":[{"v":new Date(2010,11,09)},{"v":
0.93}]},{"c":[{"v":new Date(2010,11,10)},{"v":0.83}]}...
?On Thursday, January 23, 2014 3:10:37 PM UTC-4, Sergey wrote: > > Dates must be represented in a very particular way. We expect strings in > the same form as you would construct a Date object in JavaScript. For > example, the string "Date(2012, 0, 15, 8, 10)" represents 8:10am on January > 15, 2012. > > - Sergey > > > On Thu, Jan 23, 2014 at 2:08 PM, Thomas Crowell > <[email protected]<javascript:> > > wrote: > >> Hi, >> >> I've been working on a script to query data, return it in JSON format, >> and then plot the data in a annotated timeline, but when trying to put the >> JSON formatted data into a Google DataTable, I get the error my browsers >> console: >> Uncaught TypeError: Object 09/12/2010 has no method 'getTime' >> >> My JSON data looks like: >> >> {"cols":[{"label":"dated","type":"date"},{"label":"price","type":"number"}],"rows":[{"c":[{"v":"09\/12\/2010"},{"v":0.93}]},{"c":[{"v":"10\/12\/2010"},{"v":0.83}]},{"c":[{"v":"13\/12\/2010"},{"v":0.84}]},{"c":[{"v":"14\/12\/2010"},{"v":0.84}]},{"c":[{"v":"15\/12\/2010"},{"v":0.79}]},{"c":[{"v":"16\/12\/2010"},{"v":0.79}]},{"c":[{"v":"17\/12\/2010"},{"v":0.82}]},{"c":[{"v":"20\/12\/2010"},{"v":0.79}]},{"c":[{"v":"21\/12\/2010"},{"v":0.83}]},{"c":[{"v":"23\/12\/2010"},{"v":0.82}]},{"c":[{"v":"27\/12\/2010"},{"v":0.82}]},{"c":[{"v":"28\/12\/2010"},{"v":0.84}]},{"c":[{"v":"29\/12\/2010"},{"v":0.94}]},{"c":[{"v":"30\/12\/2010"},{"v":0.87}]},{"c":[{"v":"31\/12\/2010"},{"v":0.89}]},{"c":[{"v":"03\/12\/2011"},{"v":0.86}]},{"c":[{"v":"04\/12\/2011"},{"v":0.87}]},{"c":[{"v":"05\/12\/2011"},{"v":0.85}]},{"c":[{"v":"06\/12\/2011"},{"v":0.85}]}]} >> >> I have attached the php file that queries the data, and here is the >> javascript snippet that calls it. The error comes from the line: var >> data = new google.visualization.DataTable(JSON.parse(jsonData)); >> >> var jsonData = $.ajax({ >> url: "http://localhost/test/Querymydata.php", >> dataType:"json", >> crossDomain : true, >> async: false >> }).responseText; >> var data = new google.visualization.DataTable(JSON.parse(jsonData)); >> >> Thanks for any help solving this. >> >> -- >> 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]<javascript:> >> . >> To post to this group, send email to >> [email protected]<javascript:> >> . >> Visit this group at >> http://groups.google.com/group/google-visualization-api. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- 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.
