Hi,

I am working on generating query from a data table which is not
available directly using the API. Here are the steps I've taken so
far.

function drawVisualization() {
                dataQuery = new google.visualization.Query('http://
spreadsheets.google.com/tq?
key=0Atdrr8g9_zEudEFZQnpDLUVjNzlCa0FqbWlUdGNhYkE');
                // Send the query with a callback function.
                dataQuery.send(handleQueryResponse);
        }

    function handleQueryResponse(response) {
                if (response.isError()) {
                        alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
                        return;
                }
                data = response.getDataTable();
                visualization = new
google.visualization.Table(document.getElementById('render1'));
                visualization.draw(data, {'height':'300px'});
                JSONData = data.toJSON()

                $.ajax({
                        type: "POST",
                        url: "http://przoomin.appspot.com/getResponse";,
                        data: JSONData,
                        dataType: "html",
                }).success(function(msg) {
                        alert(msg);
                        $('#render2').html(msg);
                        dataQuery1 = new google.visualization.Query(msg);
                        // Send the query with a callback function.
                        dataQuery1.send(handleQueryResponse1);
                        alert("Got something back");
                });
        }
        function handleQueryResponse1(response) {
                if (response.isError()) {
                        alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
                        return;
                }
                data1 = response.getDataTable();
                visualization = new
google.visualization.Table(document.getElementById('render3'));
                visualization.draw(data1, null);
        }

    google.setOnLoadCallback(drawVisualization);

However I get this error message
Error in query: Request timed out.

Can someone please help me figure out what's going on here?

The first alert message displays the following response.

google.visualization.Query.setResponse({'status':'ok','table':'{'cols':
[{'id':'A','label':'Key','type':'string','pattern':''},
{'id':'B','label':'LCOE(Real)','type':'number','pattern':'#0.###############'},
{'id':'C','label':'LCOE(Nominal)','type':'number','pattern':'#0.###############'},
{'id':'D','label':'Enet','type':'number','pattern':'#0.###############'},
{'id':'E','label':'RequestDateTime','type':'datetime','pattern':'M/d/
yyyy H:mm:ss'},
{'id':'F','label':'RunDateTime','type':'datetime','pattern':'M/d/yyyy
H:mm:ss'}],'rows':[{'c':[{'v':'SunEdison|1Q2011'},{'v':
13.4657269942,'f':'13.4657269942'},{'v':
16.2351677257,'f':'16.2351677257'},{'v':
23006773.4004,'f':'23006773.4004'},{'v':'Date(2011, 11, 22, 10, 1,
24)','f':'12/22/2011 10:01:24'},{'v':'Date(2011, 11, 22, 10, 1,
24)','f':'12/22/2011 10:01:24'}]},{'c':[{'v':'SunEdison|2Q2011'},{'v':
13.4657269942,'f':'13.4657269942'},{'v':
16.2351677257,'f':'16.2351677257'},{'v':
23006773.4004,'f':'23006773.4004'},{'v':'Date(2011, 11, 22, 10, 1,
25)','f':'12/22/2011 10:01:25'},{'v':'Date(2011, 11, 22, 10, 1,
24)','f':'12/22/2011 10:01:24'}]}],'p':null}'});

Thanks.

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