Your dates are input improperly. They need to be strings in the format:
"Date(2001,0,1)"
notice there is no "new" keyword. Your JSON should look like this:
{"cols":[{"id":"date","label":"date","type":"date","pattern":""},{"id":"ColA","label":"ColA","type":"number","pattern":""},{"id":"ColB","label":"ColB","type":"number","pattern":""}],"rows":[{"c":[{"v":"Date(2001,0,1)"},{"v":551.0},{"v":422.0}]},{"c":[{"v":"Date(2001,0,2)"},{"v":521.0},{"v":422.0}]},{"c":[{"v":"Date(2001,0,3)"},{"v":430.0},{"v":422.0}]},{"c":[{"v":"Date(2001,0,4)"},{"v":399.0},{"v":422.0}]},{"c":[{"v":"Date(2001,0,5)"},{"v":402.0},{"v":336.0}]},{"c":[{"v":"Date(2001,0,6)"},{"v":336.0},{"v":336.0}]},{"c":[{"v":"Date(2001,0,7)"},{"v":474.0},{"v":336.0}]},{"c":[{"v":"Date(2001,0,8)"},{"v":527.0},{"v":336.0}]},{"c":[{"v":"Date(2001,0,9)"},{"v":462.0},{"v":336.0}]},{"c":[{"v":"Date(2001,0,10)"},{"v":315.0},{"v":336.0}]}]}
On Thursday, May 17, 2012 6:05:33 PM UTC-4, Steve Sether wrote:
>
> I'm getting this error message as soon as I put my json data into the
> DataTable. I've searched the forums and found several others that had
> this problem, but none of these solutions worked (I've even used the
> data they posted with the corrections instead of my own, still the
> same error.)
>
> I'm at a loss right now. My json is below, and was generated using
> the Google java lib. If I use data without a date type, everything
> works fine.
>
> the code is simply:
> var jsonData = $.ajax({
> url: "data2.json",
> dataType:"text",
> async: false
> }).responseText;
>
> var data = new google.visualization.DataTable(jsonData);
>
>
> data2.json is simply:
>
> {"cols":[{"id":"date","label":"date","type":"date","pattern":""},
> {"id":"ColA","label":"ColA","type":"number","pattern":""},
> {"id":"ColB","label":"ColB"
> ,"type":"number","pattern":""}],"rows":[{"c":[{"v":new Date(2001,0,1)},
> {"v":551.0},{"v":422.0}]},{"c":[{"v":new Date(2001,0,2)},{"v":521.0},
> {"v":422.0
> }]},{"c":[{"v":new Date(2001,0,3)},{"v":430.0},{"v":422.0}]},{"c":
> [{"v":new Date(2001,0,4)},{"v":399.0},{"v":422.0}]},{"c":[{"v":new
> Date(2001,0,5)},{
> "v":402.0},{"v":336.0}]},{"c":[{"v":new Date(2001,0,6)},{"v":336.0},
> {"v":336.0}]},{"c":[{"v":new Date(2001,0,7)},{"v":474.0},{"v":336.0}]},
> {"c":[{"v":
> new Date(2001,0,8)},{"v":527.0},{"v":336.0}]},{"c":[{"v":new
> Date(2001,0,9)},{"v":462.0},{"v":336.0}]},{"c":[{"v":new
> Date(2001,0,10)},{"v":315.0},{"v
> ":336.0}]}]}
>
>
> Please help!
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/9Uo-DpJsld8J.
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.