Hi,

Your problem is that you use quotes ("") over your data. The DataTable
constructor takes an object, not a string.
So something like:
var strdata = {cols:....}; // without the ""
var data = new google.visualization.DataTable(strdata, 0.5);

should work.

- VizBoy.

On Wed, May 6, 2009 at 11:42 AM, PS <[email protected]> wrote:

>
> Hi,
>
> I am trying to utilize the api's in JavaScript and have encountered a
> peculiar problem.
>
> If I instantiate a DataTable object as follows it fails:
>
> var strdata = "{ cols:[{id:'Bucket', label:'Bucket', type:'string'},
> {id:'AllocatedMY', label:'Allocated MY', type:'number'}], rows: [ {c:
> [{v:' 3 - A '}, {v: 40 }]} , {c:[{v:' 5 - B '}, {v: 94.15 }]} , {c:
> [{v:' 6 - C'}, {v: 146.2 }]} , {c:[{v:' 7 - D '}, {v: 11.858 }]} , {c:
> [{v:' 8 - E '}, {v: 198.9466 }]} , {c:[{v:' 1 - PFS '}, {v:
> 122.135 }]} , {c:[{v:' 2 - Wealth '}, {v: 265.6 }]} ]}";
> var data = new google.visualization.DataTable(strdata,0.5);
>
> however, if I use the JSON data directly into the constructor it works
> fine!
>
> Any ideas?
>
> Thanks
>
> Pervez
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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