google.visualization.events.addListener( 
          geomap, "regionClick", function(e) {
          console.log(e["region"]);
          console.log(data.getValue(e["region"],1));
          }); 

I use this code to see which region is clicked. The e["region"] gives the row number of that region, and then I use getValue to see the region(marker) name.

Now, in the console log shows up this error:

Uncaught Error: Invalid row index 1. Should be in the range [0-14]

How can the row index 1 be invalid, as it is in the range [0-14] ?

EDIT:

There you go, more code :)

     <!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Google Visualization API Sample</title>
  <script type="text/javascript" src="http://www.google.com/jsapi"></script>
 <script type="text/javascript">

   google.load("visualization", "1", {"packages": ["geomap"]});

   google.setOnLoadCallback(drawMap);



    function drawMap() {

      var data = new google.visualization.DataTable();

      data.addRows(24);

      data.addColumn("string", "City");

      data.addColumn("number", "Numar anunturi");data.setValue(0, 0, 'Ilfov');

    data.setValue(0, 1, 19);



     data.setValue(1, 0, 'Giurgiu');

    data.setValue(1, 1, 7);



     data.setValue(2, 0, 'Brasov');

    data.setValue(2, 1, 6);



     data.setValue(3, 0, 'Buzau');

    data.setValue(3, 1, 3);



     data.setValue(4, 0, 'Valcea');

    data.setValue(4, 1, 3);



     data.setValue(5, 0, 'Dolj');

    data.setValue(5, 1, 3)
Edit
Report