The coding gets to the first alert test in the selectHandler function but never gets to the second alert. Meaning that it stops at the var selection = chart.getSelection(); portion of code.
I just can't figure it out. On Tuesday, October 21, 2014 2:28:06 PM UTC-7, [email protected] wrote: > > Hello guys, > > I'm having a problem with regionClick and getting the state that was > selected. I've included my code below and am probably missing something > really easy. Can any of you help me figure this out? > > >> google.setOnLoadCallback(drawRegionsMap); >> >> function drawRegionsMap() { >> var data = google.visualization.arrayToDataTable([ >> ['States'], >> ['Washington'], >> ['Oregon'], >> ['Idaho'], >> ['Arizona'], >> ['Utah'] >> ]); >> >> var options = { >> region: 'US', >> dataMode: 'regions', >> resolution:'provinces', >> enableRegionInteractivity: true >> }; >> >> var chart = new >> google.visualization.GeoChart(document.getElementById('regions_div')); >> >> chart.draw(data, options); >> >> google.visualization.events.addListener(chart, 'regionClick', >> selectHandler); >> } >> >> function selectHandler(e) { >> >> alert('Test'); >> >> var selection = chart.getSelection(); >> >> alert('Second Test'); >> >> var state = data.getValue(selection[0].row,0); >> >> alert('You selected ' + state); >> >> switch(state){ >> case "Washington": >> alert('Washington'); >> //window.location = ""; >> break; >> case "Oregon": >> alert('Oregon'); >> //window.location = ""; >> break; >> case "Idaho": >> alert('Idaho'); >> //window.location = ""; >> break; >> case "Utah": >> alert('Utah'); >> //window.location = ""; >> break; >> case "Arizon": >> alert('Arizon'); >> //window.location = ""; >> break; >> } >> } > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/d/optout.
