your error is with the "number" type. you wrote "numeric" where it needs to
be "number"
change it to:
{cols:[
{id:'A', label:'Fruit', type:'string'},
{id:'B', label:'Year', type:'datetime'},
{id:'C', label:'Systolic', type:'number'},
{id:'D', label:'Diastolic', type:'number'},
],rows:[
{c:[{v:'Patients'}, {v:new Date (1901,0, 1)}, {v:160}, {v: 100}]},
{c:[{v:'Patients'}, {v:new Date (1902,0, 1)}, {v:180}, {v: 120}]},
{c:[{v:'Patients'}, {v:new Date (1903,0, 1)}, {v:100}, {v: 80}]},
]}
On Mon, Nov 7, 2011 at 3:47 AM, Aaron Marden <[email protected]> wrote:
> Hello. I am trying to create a motion chart by passing JSON into the
> google.visualization.DataTable(), however I get one of two errors I am
> not entirely sure how to overcome. Example JSON text I am trying to
> pass looks like:
> {
> cols:[{id:'A', label:'Fruit', type:'string'},
> {id:'B', label:'Year', type:'datetime'},
> {id:'C', label:'Systolic', type:'numeric'},
> {id:'D', label:'Diastolic', type:'numeric'},
> ],
> rows:[{c:[{v:'Patients'}, {v:new Date (1901,0, 1)}, {v:160}, {v:
> 100}]},
> {c:[{v:'Patients'}, {v:new Date (1902,0, 1)}, {v:180}, {v:
> 120}]},
> {c:[{v:'Patients'}, {v:new Date (1903,0, 1)}, {v:100}, {v:
> 80}]},
> ]
> }
>
>
> The problem I am having is that if I submit this code, I get an error
> message stating variables can either be numbers or strings. However,
> if I change the second column from datetime to string, I get the error
> message saying that the 2nd column must be a date. I have tried a
> myriad of variable types including: date, year, quarter. However, I
> consistently get the message that only string or number column types
> are allowed. I have seen other people's JSON text include a date so I
> am wondering if anyone has an idea on what I am doing wrong or how I
> can fix this problem. Thanks.
>
> --
> 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.
>
>
--
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.