Visualization via Python Data Source

49 views
Skip to first unread message

Chen Harel

unread,
Dec 31, 2008, 2:29:36 AM12/31/08
to Google Visualization API, maayan...@gmail.com
Hi, I'm trying to view a visualization table via iGoogle Gadget,
I've used all available examples and information on the API pages but
still gets a timeout for my requests...
Now even running the simple example when the datasource is a
spreadsheet doesn't work...
Once I get this one working, I'll simply implement the response to
match my own python datasource implementation
(That will be written here once you guys point me to what i'm doing
wrong :) )

The client side:
function search_test() {
var url = 'http://spreadsheets.google.com/tq?key=pxk4YcSK2-
L24X8uhC7bNPg&range=A2:B4&gid=0';
var query = new google.visualization.Query(url);

// Send the query with a callback function.
query.send(handleQueryResponse);

}

function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage
() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var table = new google.visualization.Table
(document.getElementById('main_div'));
table.draw(data, {page: 'enable', pageSize: 15});
}

Thanks a lot.
Chen

VizGuy

unread,
Dec 31, 2008, 2:49:17 AM12/31/08
to google-visua...@googlegroups.com, maayan...@gmail.com
Hi Chen

Generally the code looks good, but there are a few things:
1. The spreadsheet you are trying to access is not accessible to me, so I can't verify you have data in it and so on. I assume you have data in it.
You can try to open in your browser the url that you put in the query, and see the json response you get. If it contains the word error, you should see what it is.
2. This is only a snippet, so I assume you have specified all of the correct script tags and used google.load correctly.

If all of this was done, it should work.
If it doesn't I need more info in order to help.
For example, you could send a full sample page, accessing a sample spreadsheet or some other way we can try to recreate the problem.

Regards,
VizGuy

Chen Harel

unread,
Dec 31, 2008, 5:45:31 AM12/31/08
to Google Visualization API
Hey, thanks a lot.
Of course I missed the google.load :)
(It was there, but in a function that was not yet called)

So now I am getting something, but I still get an error that "User is
not signed in"
Now that occurs whether I'm trying to access the spreadsheet, and more
important when I try to use my DataTable:
http://epihourtesting.appspot.com/SearchShow?ShowName=lost
(For instance...)

+ Is it nessecery to define a OnLoadCallback function? Cause I don't
want one :)

Thanks a lot for your help!

On Dec 31, 9:49 am, VizGuy <viz...@google.com> wrote:
> Hi Chen
>
> Generally the code looks good, but there are a few things:
> 1. The spreadsheet you are trying to access is not accessible to me, so I
> can't verify you have data in it and so on. I assume you have data in it.
> You can try to open in your browser the url that you put in the query, and
> see the json response you get. If it contains the word error, you should see
> what it is.
> 2. This is only a snippet, so I assume you have specified all of the correct
> script tags and used google.load correctly.
>
> If all of this was done, it should work.
> If it doesn't I need more info in order to help.
> For example, you could send a full sample page, accessing a sample
> spreadsheet or some other way we can try to recreate the problem.
>
> Regards,
> VizGuy
>
> On Wed, Dec 31, 2008 at 9:29 AM, Chen Harel <chook.ha...@gmail.com> wrote:
>
> > Hi, I'm trying to view a visualization table via iGoogle Gadget,
> > I've used all available examples and information on the API pages but
> > still gets a timeout for my requests...
> > Now even running the simple example when the datasource is a
> > spreadsheet doesn't work...
> > Once I get this one working, I'll simply implement the response to
> > match my own python datasource implementation
> > (That will be written here once you guys point me to what i'm doing
> > wrong :) )
>
> > The client side:
> > function search_test()    {
> >    var url = 'http://spreadsheets.google.com/tq?key=pxk4YcSK2-
> > L24X8uhC7bNPg&range=A2:B4&gid=0<http://spreadsheets.google.com/tq?key=pxk4YcSK2-L24X8uhC7bNPg&range=A...>
> > ';

Chen Harel

unread,
Jan 2, 2009, 6:01:20 AM1/2/09
to Google Visualization API
Hey,
Happy new year :)
I've just realized I can give point you to the source in a very
efficient way, since it's an open source project on Google code...

http://code.google.com/p/tvepisodes/

The client (gadget) is myepisodeTemp.xml and the server is
searchShows.py

If you need any more info from me, please ask

VizBoy

unread,
Jan 4, 2009, 3:08:07 AM1/4/09
to google-visua...@googlegroups.com
Hi,

Are you sure your code is in sync with the appEngine?
Because the appEngine returns:
handleQueryResponse({version:'0.5',reqId:'0',status:'o...
and the python code that i saw in the svn always returns:
google.visualization.Query.setResponse({'version': .....
So two differences, the name of the function and the quoting over version. The first of these is very important!
The function in the beginning of the response has to be google.visualization.Query.setResponse() for this to work, and NOT the name of the callback function.
The callback function is given to the Query class through the send() method and that class handles everything and passes control to *your* callback function eventually.

So please check why your reponse is handleQueryResponse(...) and not google.visualization.Query.setResponse(...)

Regards,
    VizBoy.

Chen Harel

unread,
Jan 4, 2009, 7:20:41 AM1/4/09
to Google Visualization API
Hi, thanks a lot for clarifying things up.
Now it's working and we can get ahead and do some business.

On Jan 4, 10:08 am, VizBoy <viz...@google.com> wrote:
> Hi,
>
> Are you sure your code is in sync with the appEngine?
> Because the appEngine returns:
> handleQueryResponse({version:'0.5',reqId:'0',status:'o...
> and the python code that i saw in the svn always returns:
> google.visualization.Query.setResponse({'version': .....
> So two differences, the name of the function and the quoting over version.
> The first of these is very important!
> The function in the beginning of the response has to be
> google.visualization.Query.setResponse() for this to work, and NOT the name
> of the callback function.
> The callback function is given to the Query class through the send() method
> and that class handles everything and passes control to *your* callback
> function eventually.
>
> So please check why your reponse is handleQueryResponse(...) and not
> google.visualization.Query.setResponse(...)
>
> Regards,
>     VizBoy.
>
Reply all
Reply to author
Forward
0 new messages