Re: Need some help with an geochart

276 views
Skip to first unread message

asgallant

unread,
Oct 25, 2012, 5:08:19 PM10/25/12
to google-visua...@googlegroups.com
I put that into a jsfiddle (http://jsfiddle.net/asgallant/JGejs/), and it works fine in IE9 for me.

On Thursday, October 25, 2012 2:03:31 PM UTC-4, Vitor dos Reis wrote:
Hello,

This code it's ok at Chrome but won't works in IE9.

What's wrong? Thanks

<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(drawMarkersMap);

      function drawMarkersMap() {
      var data = google.visualization.arrayToDataTable([
        ['string',   'City',   'Value'],
        ['PT-01',   'Aveiro',      60],
        ['PT-02',   'Beja',     9],
        ['PT-03',   'Braga',    8],
        ['PT-04',   'Braganca',     4],
        ['PT-05',   'Castelo Branco',   4],
        ['PT-06',   'Coimbra',     26],
        ['PT-07',   'Evora',   8],
        ['PT-08',   'Faro',  33],
        ['PT-09',   'Guarda', 20],
        ['PT-10',   'Leiria',     26],
        ['PT-11',   'Lisboa',  107],
        ['PT-12',   'Portalegre',  7],
        ['PT-13',   'Porto',  80],
        ['PT-14',   'Santarem',  30],
        ['PT-15',   'Setubal',  57],
        ['PT-16',   'Viana do Castelo',  8],
        ['PT-17',   'Vila Real',  4],
        ['PT-18',   'Viseu',  27]
      ]);

      var options = {
        region: 'PT',
        resolution: 'provinces',
        displayMode: 'auto',
        colorAxis: {colors: ['#f2ff00', '#fc6000', '#a00000', '#700000']}
      };

      var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
      chart.draw(data, options);
    };
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 700px; height: 500px;"></div>
  </body>
</html>

Carlos Moreira

unread,
Oct 26, 2012, 4:48:09 AM10/26/12
to google-visua...@googlegroups.com
Also tested and It works fine, altough it throws a js error.
You can try and set a doctype <!DOCTYPE HTML> for example and change
https://www.google.com/jsapi to http://www.google.com/jsapi
Probably this was not the problem, but you can try.
Message has been deleted

Vitor dos Reis

unread,
Oct 26, 2012, 5:43:08 AM10/26/12
to google-visua...@googlegroups.com
In some PC in my office network (IE9 with compatibility mode off), I receive a red block: "Requested map does not exist.×"

I add the doctype and head meta without lucky.

Changing https://www.google.com/jsapi to http://www.google.com/jsapi hide the red block and show me a blank page.

In the Console:
SCRIPT5007: Unable to get value of the property 'arrayToDataTable': object is null or undefined

Any tip? Thanks

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//PT" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>My GeoMap</title>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type='text/javascript'>
     google.load('visualization', '1', {'packages': ['geochart']});

      function drawMarkersMap() {
      var data = google.visualization.arrayToDataTable([
        ['string',  'City',   'Registos'],
     google.setOnLoadCallback(drawMarkersMap);
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 700px; height: 500px;"></div>
  </body>
</html>

asgallant

unread,
Oct 26, 2012, 11:12:18 AM10/26/12
to google-visua...@googlegroups.com
Does it work when you use the jsfiddle link I posted above?  Does it work in other browsers?
Reply all
Reply to author
Forward
0 new messages