This code works fine for me and i get a nice column chart.
Try it too...
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi
"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["columnchart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var json =
{"cols":[{"id":"application","label":"Application","type":"string"},{"id":"app_duration","label":"Duration
(Secs)","type":"number"}],"rows":[{"c":[{"v":"firefox.exe","f":"firefox.exe"},{"v":3417,"f":"3417"}]},{"c":[{"v":"eclipse.exe","f":"eclipse.exe"},{"v":2499,"f":"2499"}]},{"c":[{"v":"msnmsgr.exe","f":"msnmsgr.exe"},{"v":2138,"f":"2138"}]},{"c":[{"v":"chrome.exe","f":"chrome.exe"},{"v":1061,"f":"1061"}]},{"c":[{"v":"VyChat.exe","f":"VyChat.exe"},{"v":990,"f":"990"}]},{"c":[{"v":"Explorer.EXE","f":"Explorer.EXE"},{"v":849,"f":"849"}]},{"c":[{"v":"msvs.exe","f":"msvs.exe"},{"v":555,"f":"555"}]},{"c":[{"v":"postbox.exe","f":"postbox.exe"},{"v":198,"f":"198"}]},{"c":[{"v":"googletalk.exe","f":"googletalk.exe"},{"v":169,"f":"169"}]},{"c":[{"v":"iexplore.exe","f":"iexplore.exe"},{"v":140,"f":"140"}]},{"c":[{"v":"java.exe","f":"java.exe"},{"v":119,"f":"119"}]},{"c":[{"v":"thunderbird.exe","f":"thunderbird.exe"},{"v":109,"f":"109"}]},{"c":[{"v":"notepad++.exe","f":"notepad++.exe"},{"v":91,"f":"91"}]},{"c":[{"v":"taskmgr.exe","f":"taskmgr.exe"},{"v":25,"f":"25"}]},{"c":[{"v":"Skype.exe","f":"Skype.exe"},{"v":15,"f":"15"}]},{"c":[{"v":"notepad.exe","f":"notepad.exe"},{"v":8,"f":"8"}]},{"c":[{"v":"SnagIt32.exe","f":"SnagIt32.exe"},{"v":8,"f":"8"}]},{"c":[{"v":"LogMeInSystray.exe","f":"LogMeInSystray.exe"},{"v":8,"f":"8"}]},{"c":[{"v":"IDMan.exe","f":"IDMan.exe"},{"v":4,"f":"4"}]},{"c":[{"v":"WinRAR.exe","f":"WinRAR.exe"},{"v":4,"f":"4"}]},{"c":[{"v":"wuauclt.exe","f":"wuauclt.exe"},{"v":3,"f":"3"}]}]};
var dt= new google.visualization.DataTable(json);
var chart = new
google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(dt, {width: 400, height: 240, is3D: true, title:
'Application Usage'});
}
</script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
2009/3/26 alee amin <[email protected]>
> here is the exact json that i m getting from the server
>
>
> {"gviz":{"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":3417,"f":"3417"}]},{"c":[{"v":"eclipse.exe","f":"eclipse.exe"},{"v":2499,"f":"2499"}]},{"c":[{"v":"msnmsgr.exe","f":"msnmsgr.exe"},{"v":2138,"f":"2138"}]},{"c":[{"v":"chrome.exe","f":"chrome.exe"},{"v":1061,"f":"1061"}]},{"c":[{"v":"VyChat.exe","f":"VyChat.exe"},{"v":990,"f":"990"}]},{"c":[{"v":"Explorer.EXE","f":"Explorer.EXE"},{"v":849,"f":"849"}]},{"c":[{"v":"msvs.exe","f":"msvs.exe"},{"v":555,"f":"555"}]},{"c":[{"v":"postbox.exe","f":"postbox.exe"},{"v":198,"f":"198"}]},{"c":[{"v":"googletalk.exe","f":"googletalk.exe"},{"v":169,"f":"169"}]},{"c":[{"v":"iexplore.exe","f":"iexplore.exe"},{"v":140,"f":"140"}]},{"c":[{"v":"java.exe","f":"java.exe"},{"v":119,"f":"119"}]},{"c":[{"v":"thunderbird.exe","f":"thunderbird.exe"},{"v":109,"f":"109"}]},{"c":[{"v":"notepad++.exe","f":"notepad++.exe"},{"v":91,"f":"91"}]},{"c":[{"v":"taskmgr.exe","f":"taskmgr.exe"},{"v":25,"f":"25"}]},{"c":[{"v":"Skype.exe","f":"Skype.exe"},{"v":15,"f":"15"}]},{"c":[{"v":"notepad.exe","f":"notepad.exe"},{"v":8,"f":"8"}]},{"c":[{"v":"SnagIt32.exe","f":"SnagIt32.exe"},{"v":8,"f":"8"}]},{"c":[{"v":"LogMeInSystray.exe","f":"LogMeInSystray.exe"},{"v":8,"f":"8"}]},{"c":[{"v":"IDMan.exe","f":"IDMan.exe"},{"v":4,"f":"4"}]},{"c":[{"v":"WinRAR.exe","f":"WinRAR.exe"},{"v":4,"f":"4"}]},{"c":[{"v":"wuauclt.exe","f":"wuauclt.exe"},{"v":3,"f":"3"}]}]}}}
>
> ..alee
> http://techboard.wordpress.com
>
>
>
> On Thu, Mar 26, 2009 at 1:56 PM, VizBoy <[email protected]> wrote:
>
>> This error looks like there's either a problem in your json or a bug in
>> the chart.
>> Please paste the exact json you received in the response and i'll help you
>> debug.
>>
>> - V.
>>
>> 2009/3/26 alee amin <[email protected]>
>>
>> thanks. but this isn't helping me much .. or there is something else
>>> creating problemhere is my complete code listing
>>>
>>>
>>> var fnResponseSuccess = function (o) {
>>> if (o.responseText !== undefined){
>>> var response=YAHOO.lang.JSON.parse(o.responseText);
>>> var gvizData = response.gviz;
>>> var chart = new
>>> google.visualization.ColumnChart(document.getElementById('divYuiEarlyBirds'));
>>> var dt = new google.visualization.DataTable(gvizData);
>>> chart.draw(dt, {width: 400, height: 240, is3D: true, title:
>>> 'Application Usage'});
>>> alert ('done');
>>>
>>> }
>>>
>>>
>>> and this is resulting in this error in fireburd
>>>
>>>
>>> this.A is undefined
>>> (?)()()default,...hart.I.js (line 92)
>>> (?)()()default,...hart.I.js (line 376)
>>> fnResponseSuccess()(Object tId=0 status=200 statusText=OK)dashboard.jsp
>>> (line 87)
>>> setHeader()(Object conn=XMLHttpRequest tId=0, Object cache=false,
>>> undefined)connection-min.js (line 7)
>>> setHeader()()connection-min.js (line 7)
>>> columnchart.I.js
>>>
>>>
>>> ..alee
>>> http://techboard.wordpress.com
>>>
>>>
>>>
>>> On Thu, Mar 26, 2009 at 12:36 PM, VizBoy <[email protected]> wrote:
>>>
>>>> google.visualization.Da
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---