Thank you for your answer. I am still struggling to receive the the regionClick Event, when the user clicks on a country. When I click on one of the countries, the doSometing function is not called.
I used the following code, which is an extension of the regions example. Sorry, I didn't make that clear in the first posting. <html> <head> <script type='text/javascript' src='http://www.google.com/jsapi'></ script> <script type='text/javascript'> function doSomething(regionData){ alert(regionData); } google.load('visualization', '1', {'packages': ['geomap']}); google.setOnLoadCallback(drawMap); function drawMap() { var data = new google.visualization.DataTable(); data.addRows(2); data.addColumn('string', 'Country'); data.addColumn('number', 'Popularity'); data.setValue(0, 0, 'Germany'); data.setValue(0, 1, 200); data.setValue(1, 0, 'United States'); data.setValue(1, 1, 300); var options = {}; options['dataMode'] = 'regions'; var container = document.getElementById('map_canvas'); geomap = new google.visualization.GeoMap(container); google.visualization.events.addListener( geomap, 'regionClick', function(e) { doSomething(e['region']); }); google.visualization.events.addListener( geomap, 'drawingDone', function() { alert('drawingDone was fired'); }); geomap.draw(data, options); }; </script> </head> <body> <div id='map_canvas'></div> </body> </html> On 15 Dez., 10:47, VizBoy <[email protected]> wrote: > Hi, > > I can't tell what's really the problem unless you send me a full code > snippet, but first try these tips: > 1. You have an unnecessary parameter in the function you're using for the > select event as a select event has no parameters. > 2. A select event isn't always fired. It is documented. > 3. Here are code segments from an example we've tried which works: > > a. Here is how to add select event for geomap: > > google.visualization.events.addListener(geomap, 'select', function() { > alert('Select event called, selected row is ' + > geomap.getSelection()[0].row); > > }); > > b. Here is how to add regionclick event for geomap: > > google.visualization.events.addListener( > globalGeomap, 'regionClick', function(e) { > doSomething(e['region']); > > }); > > Hope this helps. > > - VizBoy. > > On Mon, Dec 15, 2008 at 2:12 AM, [email protected] < > > [email protected]> wrote: > > > I was wondering, how I can handle Events in the Geomap Regions > > example. I tried to see the events thrown by adding a > > > google.visualization.events.addListener(geomap, 'select', function(a) > > {alert(a)}); > > > for the 'select' and 'regionClick' Events, but I did not retrieve any > > triggers. > > > Where do I have to add the listener to the geomap object? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en -~----------~----~----~----~------~----~------~--~---
