title: getSelection() to get data from row in Google Chart API
body: <p>I'm trying to trigger the creation of a new BarChart with Google's Chart API when a user clicks on a particular bar.  I think I understand the concepts, and wanted to at least get the getSelection() function to work and display what bar the user clicked on.  But everytime, when you click on the bar, it just freezes with the display and no java alert. Any thoughts?</p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
              google.setOnLoadCallback(drawChart);
  
              function drawChart() {
                  var visualization = new google.visualization.BarChart(document.getElementById('acctmeta'));
                  var json_data = new google.visualization.DataTable({{acctmeta_json}});          
  
                  visualization.draw(json_data, {width: 850, height: 600, title: 'Collection Level Populated Metadata Fields',
                                    chartArea: {width:"50%"},
                                    vAxis: {title: 'Collection Title/ID', titleTextStyle: {color: 'green'}},
                                    hAxis: {logScale:false, title:'Fields Populated', titleTextStyle: {color: 'green'}}
                                   });
  
                  // Add our selection handler.
                  google.visualization.events.addListener(visualization, 'select', selectHandler);
  
  
                  // The selection handler.
                  // Loop through all items in the selection and concatenate
                  // a single message from all of them.
                  function selectHandler() {        
                    alert(data.getValue(chart.getSelection()[0].row, 0));
                  }
  
              } //end of draw chart function          
              &lt;/script&gt;
  </code></pre>