user1043491
user1043491

Reputation: 11

How to display multiple regions in Geo Chart

I have made a Google Geo Chart visualising data for EU member states but can't figure out how to display just European regions, rather than showing the whole world map.

In a Google guide it says it has the following strings: 154 - (Northern Europe), 155 - (Western Europe), 039 - (Southern Europe) but there is no Central/Eastern Europe on the list, so I think it would be best to use ISO-3166 codes.

If anyone could help with how to modify the following code, I'd be very grateful!

   function drawVisualization() {
    var data = new google.visualization.DataTable();
    data.addRows(24);
    data.addColumn('string', 'Country');
    data.addColumn('number', 'Inability to heat home');
    data.setValue(0, 0, 'Austria');
    data.setValue(0, 1, 5);
    data.setValue(1, 0, 'Belgium');
    data.setValue(1, 1, 7);
    data.setValue(2, 0, 'Bulgaria');
    data.setValue(2, 1, 32);
    data.setValue(3, 0, 'Cyprus');
    data.setValue(3, 1, 31);
    data.setValue(4, 0, 'Czech Republic');
    data.setValue(4, 1, 7);
    data.setValue(5, 0, 'Estonia');
    data.setValue(5, 1, 1);
    data.setValue(6, 0, 'Finland');
    data.setValue(6, 1, 2);
    data.setValue(7, 0, 'Germany');
    data.setValue(7, 1, 7);
    data.setValue(8, 0, 'Greece');
    data.setValue(8, 1, 16);
    data.setValue(9, 0, 'Hungary');
    data.setValue(9, 1, 11);
    data.setValue(10, 0, 'Ireland');
    data.setValue(10, 1, 4);
    data.setValue(11, 0, 'Italy');
    data.setValue(11, 1, 11);
    data.setValue(12, 0, 'Latvia');
    data.setValue(12, 1, 19);
    data.setValue(13, 0, 'Lithuania');
    data.setValue(13, 1, 25);
    data.setValue(14, 0, 'Luxembourg');
    data.setValue(14, 1, 1);
    data.setValue(15, 0, 'Netherlands');
    data.setValue(15, 1, 2);
    data.setValue(16, 0, 'Poland');
    data.setValue(16, 1, 22); 
    data.setValue(17, 0, 'Portugal');
    data.setValue(17, 1, 35);
    data.setValue(18, 0, 'Romania');
    data.setValue(18, 1, 26);
    data.setValue(19, 0, 'Slovakia');
    data.setValue(19, 1, 6);
    data.setValue(20, 0, 'Slovenia');
    data.setValue(20, 1, 7);
    data.setValue(21, 0, 'Spain');
    data.setValue(21, 1, 5);
    data.setValue(22, 0, 'Sweden');
    data.setValue(22, 1, 2);
    data.setValue(23, 0, 'United Kingdom');
    data.setValue(23, 1, 6);

    var geochart = new google.visualization.GeoChart(
      document.getElementById('visualization'));
    geochart.draw(data, {width: 556, height: 347});
    }

Upvotes: 1

Views: 6036

Answers (2)

climboid
climboid

Reputation: 6952

I would strongly recommed looking into jVectorMap map http://jvectormap.com/ I ran into a bunch of issues with google geo map specially with compatibility in Ie7. Jvector map includes a map of europe and is super easy to implement, more like a jquery plugin. The only limitation is that you do not have regios of the world independant from the world except for europe, usa and germany

Upvotes: 2

jirfe
jirfe

Reputation: 41

try to add this code:

var options = {

   displayMode: 'regions',
   region: '150'       

  };

into your visualization function. Region '150' is europe.

Upvotes: 4

Related Questions