1

Having issue with reading the Excel file on the URL.

Works fine with bar chart, line charts and pie charts.

Geomap code gives this error:

 google.setOnLoadCallback(drawVisualization);

HTML:

<html>
<head>
  <script type='text/javascript' src='https://www.google.com/jsapi'></script>
  <script type='text/javascript'>
   google.load('visualization', '1', {'packages': ['geochart']});
   google.setOnLoadCallback(drawChart);

function drawChart() {
  var query = new google.visualization.Query(
      'https://docs.google.com/spreadsheet/ccc?key=0Aih8-LAKMBsKdHRBSllqYkZnS2pfWWtGY2JueHdaRmc&usp=sharing,');

  query.send(handleQueryResponse);
}

function handleQueryResponse(response) {
  if (response.isError()) {
    alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
    return;
  }

          var data = response.getDataTable();

     var options = {
        sizeAxis: { minValue: 0, maxValue: 100 },
        region: 'US', // US
        displayMode: 'markers',
         colorAxis: {colors: ['#e7711c', '#4374e0']} // orange to blue
      };

      var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
      chart.draw(data, options);

    };

  </script>
</head>

<body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>

<head>
<title>NSF Data Online </title>
</head>


<span id='chart_div'></span>
</body>

  </head>
  <body>
    <div id="chart_div" style="width: 700px; height: 500px;"></div>
  </body>

<title>Welcome to My Web Page</title>
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii">
<meta content="MSHTML 6.00.2800.1400" name="GENERATOR">
</head>
<body>

These changes must be reflected in the web page .

</body>

<hr>

</html>
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Pulkit Bhardwaj
  • 143
  • 1
  • 2
  • 11
  • 1
    Your HTML is invalid, which could be causing all kinds of problems. You can only have 1 `` and 1 `` element on the page. Also, element ID's must be unique. Fix the HTML and try again; I suspect you will find that there is nothing wrong with your javascript, as it works fine (if a bit slowly due to geocoding; you might want to consider using the ISO codes for US states and territories, instead of state names [eg, `'US-AL'` for `'Alabama'`]): http://jsfiddle.net/asgallant/etrTb/ – asgallant Feb 03 '14 at 15:54

0 Answers0