1

I initially have the Google Visualization API Geomap on a world view (options['dataMode'] = 'regions') and I capture the 'regionClick' event when a country is clicked like so:

google.visualization.events.addListener(
    geomap, 'regionClick', function (e) {
        var rowindex = data.getFilteredRows([{column: 0, value: e['region']}]);  
        var location = data.getValue(rowindex[0], 3);
        location.href = "?ISO=" + e['region'] + "&Location=" + location;
    });

I then draw the map zoomed into the country in markers mode (options['dataMode'] = 'markers'). However, I can't seem to capture any events when the markers themselves are clicked.

The documentation ( http://code.google.com/apis/visualization/documentation/gallery/geomap.html#Events ) only refers to 'select' and 'regionClick' events neither of which are fired in this case. (Tested using Chrome 9, and IE 8.)

Has anybody had any success in doing this? Many thanks.

Carlos da Costa
  • 136
  • 1
  • 6

2 Answers2

0

I have it working on IE 8 and Chrome. First off, note the warning in the documentation if you are running this locally as file://

If that's not the case, make sure your google.visualization.GeoMap variable (the first argument to addListener) is indeed named geomap . If it is, add an alert() as the first line of code in the event handler and see if that fires. Lastly, note that unless the variable data is global, it will be out of scope if you try to access it from the event handler as you are doing.

Mutix
  • 4,196
  • 1
  • 27
  • 39
ardila
  • 1,277
  • 1
  • 13
  • 24
  • Thanks for the reply aardila. I do have it working for regions, just not the markers mode. I've attached two examples to illustrate. – Carlos da Costa Feb 02 '11 at 16:55
  • Sorry to hear it's not supported. I missed the (rather unclear) note about markers in the documentation since I'm only using regions. "In marker mode, this [event] will not be thrown for the specific country assigned in the 'region' option (if a specific country was listed)". – ardila Feb 03 '11 at 07:50
  • And then they should have added: "and the markers themselves throw no events." Oh well, at least I know and don't have to spend any more time on it! – Carlos da Costa Feb 03 '11 at 10:01
0

According to http://groups.google.com/group/google-visualization-api/browse_thread/thread/2bcb89a1eb3c647d it's not currently supported.

Carlos da Costa
  • 136
  • 1
  • 6