Hi, I tried using just the table and didn't get an error. Could you give a link to your server so I can try it and actually get the response?
- VizBoy. On Thu, Jan 29, 2009 at 1:54 PM, alee amin <[email protected]>wrote: > I created that just to test the library. which i later realized that is a > wrong approach. > Now I am getting error on the new response that is being generated by the > DataSource. the response that is being sent is listed below (i have formated > for readibility) - FireBug console gives error that "invalid label" when > this response is being received. I am unable to figure which label is it > pointing to .. ? > { > "reqId":"1", > "sig":"5277771", > "status":"ok", > "table": > { > "cols": > [ > {"id":"user","label":"User","type":"string"}, > {"id":"title","label":"Title","type":"string"}, > {"id":"application","label":"Application","type":"string"}, > {"id":"duration","label":"Duration","type":"number"} > ], > "rows": > [ > { > "c": > [ > {"f":"string","v":"PKDEV168"}, > {"f":"string","v":"Some Title"}, > {"f":"string","v":"firefox.exe"}, > {"f":"1","v":"45"} > ] > }, > { > "c": > [ > {"f":"string","v":"PKDEV168"}, > {"f":"string","v":"Some Title Part 2"}, > {"f":"string","v":"chrome.exe"}, > {"f":"1","v":"40"} > ] > } > ] > }, > "version":"0.5"} > > > ..alee > http://techboard.wordpress.com > > > > On Thu, Jan 29, 2009 at 1:09 PM, VizBoy <[email protected]> wrote: > >> Hi! >> >> I didn't quite understand why you tried to create a full response in your >> javascript code. >> It's hard for me right now to think of a usecase for this... >> Such responses are parsed by the library's internal mechanisms when using >> google.visualization.Query and such and are not meant to be used in this >> way. >> >> For this example, i would keep only the datatable part (something like >> {"cols":[{"id":"user","label": >>> >>> "User","number":"string"}, >>> {"id":"title","label":"Title","number":"string"}, >>> {"id":"application","label":"Application","number":"string"}, >>> {"id":"duration","label":"Duration","number":"number"}],"rows":[{"c": >>> [{"f":"string","v":"PKDEV168"},{"f":"string","v":"Some Title"}, >>> {"f":"string","v":"firefox.exe"},{"f":"1","v":"45"}]},{"c": >>> [{"f":"string","v":"PKDEV168"},{"f":"string","v":"Some Title Part 2"}, >>> {"f":"string","v":"chrome.exe"}, >>> {"f":"1","v":"40"}]}]} >> >> >> ) and feed it to the constructor of google.visualization.DataTable. >> >> Please elaborate if i didn't understand you correctly. >> >> - VizBoy. >> >> >> >> On Wed, Jan 28, 2009 at 4:11 PM, alee amin <mailing.list.mail.id@ >> gmail.com> wrote: >> >>> Ok, the deal is here that i am trying to create the custom RESPONSE >>> object. which should be of type QueryResponse but I am not able to create it >>> and send it to drawTable method. >>> If i try to call my local JSON dataSource (created in struts) then I am >>> always getting TIME_OUT error .. :s >>> ..alee >>> http://techboard.wordpress.com >>> >>> >>> >>> >>> On Wed, Jan 28, 2009 at 6:09 PM, _alee >>> <[email protected]>wrote: >>> >>>> >>>> I am trying to create a proof of concept implementation to evaluate >>>> the decision of Google Visualization API. I have written this sample >>>> code but it is not rendering the barchat. >>>> >>>> <html> >>>> <head> >>>> <script type="text/javascript" src="http://www.google.com/jsapi"></ >>>> script> >>>> <script type="text/javascript"> >>>> google.load("visualization", "1", {packages:["table, barchart, >>>> areachart"]}); >>>> google.setOnLoadCallback(initialize); >>>> >>>> function initialize() { >>>> alert ("alert called"); >>>> drawTable >>>> ({"reqId":"3","sig":"5982206968295329967","status":"ok","table": >>>> {"cols":[{"id":"user","label":"User","number":"string"}, >>>> {"id":"title","label":"Title","number":"string"}, >>>> {"id":"application","label":"Application","number":"string"}, >>>> {"id":"duration","label":"Duration","number":"number"}],"rows":[{"c": >>>> [{"f":"string","v":"PKDEV168"},{"f":"string","v":"Some Title"}, >>>> {"f":"string","v":"firefox.exe"},{"f":"1","v":"45"}]},{"c": >>>> [{"f":"string","v":"PKDEV168"},{"f":"string","v":"Some Title Part 2"}, >>>> {"f":"string","v":"chrome.exe"}, >>>> {"f":"1","v":"40"}]}]},"version":"0.5"}); >>>> } >>>> function drawTable(response) { >>>> alert ("entered in dataTable"); >>>> //response.isError is creating ERROR - no line of code execute after >>>> isError method is called >>>> if (response.isError()) { >>>> alert ("in if condition - there is som error"); >>>> alert('Error in query: ' + response.getMessage() >>>> + ' ' + >>>> response.getDetailedMessage()); >>>> return; >>>> } >>>> alert ("getting dataTable"); >>>> var data = response.getDataTable(); >>>> alert ("No.: of cols: "+ data.getNumberOfColumns()); >>>> var table = new >>>> google.visualization.Table(document.getElementById >>>> ('table_div')); >>>> table.draw(data, {showRowNumber: false}); >>>> >>>> // var barchart = new google.visualization.BarChart >>>> (document.getElementById('chart_div')); >>>> // barchart.draw(data, {width: 600, height: 340, is3D: >>>> true, >>>> isStacked: true, title: 'Hourly usage'}); >>>> >>>> } >>>> </script> >>>> </head> >>>> >>>> <body> >>>> <div id="table_div"></div> >>>> <div id="chart_div"></div> >>>> </body> >>>> </html> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
