The correct sheet doesn't show

30 views
Skip to first unread message

PavolK

unread,
May 31, 2015, 6:17:38 PM5/31/15
to google-visua...@googlegroups.com
What am I doing wrong here:

I'm creating a chart - I have a couple of sheets in that spreadsheet.  


THANKS A LOT FOR YOUR HELP IN ADVANCE!  I SPENT HOURS AND COULDN'T figure it out.

Posting the code below - the same is in attachment just in case the text below will not post as text (my first post in this forum).

<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

      // Load the Visualization API and the piechart package.
      google.load('visualization', '1.0', {'packages':['corechart']});

      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(drawVisualization);

      // Callback that creates and populates a data table, 
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawVisualization() {

        // Create the data table.
var wrapper = new google.visualization.ChartWrapper({
chartType: 'GeoChart',
query: 'SELECT A,BA,BB where BA > 0 ORDER BY BA',
options: {'title': 'Countries'},
 colorAxis: {colors: ['#00853f', 'red', '#e31b23']},
          backgroundColor: 'black',
          datalessRegionColor: '#f8bbd0',
          defaultColor: '#f5f5f5',
containerId: 'vis_div'
});
wrapper.draw();
      }

    </script>
  </head>
  <body>
<b>Country's Debt as % of GDP</b> (up 2012, below 2011)
    <!--Div that will hold the pie chart-->
    <div id="vis_div" style="width:1100; height:700"></div>
  </body>
</html>
DebtperGDP2012and2011.html

Anders Højlund Andersen

unread,
Sep 2, 2015, 6:41:18 AM9/2/15
to Google Visualization API, pkop...@gmail.com
Hi,

I had the same problem just now, my solution was:

My spreadsheet browser url ended like this: G6XubEHvsueJi-IqmSbI/edit#gid=1876638226

I copied this bit /gviz/tq?gid=0 from https://developers.google.com/chart/interactive/docs/spreadsheets and used it like this: G6XubEHvsueJi-IqmSbI/gviz/tq?gid=1876638226

And now it works. Hope it helps your or somebody else. best
Reply all
Reply to author
Forward
0 new messages