Hi,

A visualization always takes a parameter *of type
google.visualization.DataTable* as the data.
So if you have something in JSON form you must first create a DataTable fro
it.
In your case, if gvizData is your JSON data, then you can write
var dataTable = new google.visualization.DataTable(gvizData);
chart.draw(dataTable, ...

You can see such an example here:
http://code.google.com/apis/visualization/documentation/reference.html#DataTable

Regards,
    VizBoy.

On Thu, Mar 26, 2009 at 9:25 AM, alee amin
<[email protected]>wrote:

> I have gone through all. the problem is that i have data in form of json.
> the things that i found was something like that ..
>
>
> var data = new google.visualization.DataTable();
>         data.addColumn('string', 'Task');
>         data.addColumn('number', 'Hours per Day');
>         data.addRows(5);
>         data.setValue(0, 0, 'Work');
>
>
> as per above example found from the google api docs, we are setting the
> data manually here for each row .. what i want that i have json and i need
> to set that "json" for the table and instead of parsing each value and
> setting it like the above example i want something like .. data.setData
> (jsonResponse);
>
>
> //there is no error in json, there could be something missing due to 
> copy-paste but it// is fine.
>
> {
>       "version":"0.5",
>       "status":"OK",
>       "table":
>       {
>               "cols":
>               [
>                       
> {"id":"application","label":"Application","type":"string"},
>                       {"id":"app_duration","label":"Duration 
> (Secs)","type":"number"}
>               ],
>               "rows":
>               [
>                       {"c":
>                               [
>                                       {"v":"firefox.exe","f":"firefox.exe"},
>                                       {"v":1350,"f":"1350"}
>                               ]
>                       },
>                       {"c":
>                               [
>                                       {"v":"Explorer.EXE","f":"Explorer.EXE"},
>                                       {"v":767,"f":"767"}
>                               ]
>                       },
>               ]
>       }
> }
>
>
> write now when i do this
>
>
> var chart = new 
> google.visualization.ColumnChart(document.getElementById('divYuiEarlyBirds'));
>
> chart.draw(gvizData, {width: 400, height: 240, is3D: true, title: 
> 'Application Usage'});
>
>
> I got this error in firebug
>
>
> a.getNumberOfColumns is not a function
>
>
> and if i use chart.setData then i get the error that this function is not
> defined. now tell me the what to do.
>
> ..alee
> http://techboard.wordpress.com
>
>
>
> On Wed, Mar 25, 2009 at 7:01 PM, VizBoy <[email protected]> wrote:
>
>> Hi,
>>
>> Like *any* of the dozens of examples in our documentation site shows, it
>> is done by giving the data (instance of google.visualization.DataTable) as
>> the first parameter to the visualization's draw() function.
>> See for example
>> http://code.google.com/apis/visualization/documentation/using_overview.html
>>
>> Please try in the future to read the documentation before posting
>> questions to the group.
>> Thanks.
>>
>> Regards,
>>     VizBoy.
>>
>>
>> On Wed, Mar 25, 2009 at 9:14 AM, alee amin <mailing.list.mail.id@
>> gmail.com> wrote:
>>
>>> I have the data in json format which has been generated OR retrieved from
>>> some other request. I just want to use that data to draw the chart
>>> I was trying to search for something like ..
>>> gvizColumnChart.setData(data); but there is no function like that. or
>>> something synonym to it. can someone help in it ?
>>>
>>> regards
>>> ..alee
>>> http://techboard.wordpress.com
>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

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