Hello, I try to reproduce an example from the documentation of Google visu API which deal about getting the data from Spreadsheets <https://developers.google.com/chart/interactive/docs/spreadsheets#gid>, but I don't manage, can you help me finding the errors ? the source of errors I can see are : - the integration of the query part between the **function drawGID() {** to **chart.draw** - the selection of a part from the spreadsheet with the query language (cf. **var queryString** )
the code is online : https://jsbin.com/xelitevuja/edit?html,output, or below thx. <html> <head> <meta charset="utf-8"> <script type="text/javascript" src= "https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> // Load the Visualization API and the corechart package. & set a callback to run when G API is loaded google.charts.load('current', {packages: ['corechart', 'bar']}); google.charts.setOnLoadCallback(drawBasic); //call one vizu function drawBasic() { //get the data from a spreadsheet function drawGID() { var queryString = encodeURIComponent('SELECT A, D LIMIT 9 OFFSET 8' ); // select range var query = new google.visualization.Query( 'https://docs.google.com/spreadsheets/d/1XWJLkAwch5GXAt_7zOFDcg8Wm8Xv29_8PWuuW15qmAE/gviz/tq?gid=0&headers=1&tq=' + queryString); query.send(handleQueryResponse); } //verify if error occurs function handleQueryResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response. getDetailedMessage()); return; } var data = response.getDataTable(); // glue data var options = { // define vizu option chartArea: {width: '80%'}, hAxis: { title: 'wheat flour (enriched)', }, vAxis:{ title: 'Constraint Name', } } var chart = new google.visualization.BarChart(document. getElementById('chart_div')); chart.draw(data, options); } } </script> </head> <body> <h1 style="text-align:center;margin-bottom:50px">from G spreasheet to G chart API test </h1> <div id="chart_div"></div> </body> </html> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/a8729f28-d7f7-4f75-a6d6-78c85919b983%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
