Hello, I would like some help with the following. Everything works fine, 
data are obtained from a query, then a map is created but when I click on 
the markers nothing happens, (ie the link is not loaded)

Thanks for the Help 

PS I have already tried to execute the file from a server and not only 
locally but still the links do not fire.

<script type="text/javascript" src="http://www.google.com/jsapi";></script>


    <script type="text/javascript">
        google.load("visualization", "1", {packages:["geomap"]});

 google.setOnLoadCallback(drawVisualization);

    ///////////////////////////////
    // Function drawVisualization
    ///////////////////////////////
       function drawVisualization() {

        //SPARQL endpoint we will use to query the datasets
        var sparqlproxy = "http://data-gov.tw.rpi.edu/ws/sparqlproxy.php?";;
        //this is where the actual SPARQL query is stored
        var queryloc = "http://myquery";;
        //url that will execute the query
        var queryurl = sparqlproxy + 
"output=gvds&service-uri=http://page&query-uri="; + 
encodeURIComponent(queryloc);
        //construct the query
        var query = new google.visualization.Query(queryurl);

        //send query with callback function
        query.send(handleQueryResponse);

//    };

 //global variables
 var newdata;
 var regioncode;
 var data = null;
 
    ///////////////////////////////
    // Function handleQueryResponse
    // Checks for query errors, then processes
    ///////////////////////////////
    function handleQueryResponse(response)
{
        // Check for query response errors.
           if (response.isError())
             {
                  alert('Error in query: ' + response.getMessage() + ' ' + 
response.getDetailedMessage());
               return;
            }

        //gets the query result as a DataTable object
         var data = response.getDataTable();

        // Make sure our data isn't empty.
        if (null==data) 
                return;

          var predata = response.getDataTable();
          var vals = new Array();

            //Get all available data coming from Q
    var newdata =new google.visualization.DataTable();
        newdata.addColumn('number', 'something0');
        newdata.addColumn('number', 'something1');
        newdata.addColumn('number', 'something2');
        newdata.addColumn('string', 'something3');
        newdata.addColumn('string', 'something4');
        newdata.addColumn('string', 'something5');
        newdata.addColumn('number', 'REGCODE');
        newdata.addRows(predata.getNumberOfRows());
        
        for (var r=0; r < predata.getNumberOfRows(); r++) 
        {
                var row = [];
                row [0] = predata.getValue(r,0);
                row [1] = predata.getValue(r,1);
                row [2] = predata.getValue(r,2);
                row [3] = predata.getValue(r,3);
                row [4] = predata.getValue(r,4);
                row [5] = predata.getValue(r,5);
                row [6] = predata.getValue(r,6);
                newdata.addRow(row);          
          
                viewgeo = new google.visualization.DataView( newdata );
              viewgeo.setColumns([0, 1, 2, 3]);
          }

      //Customizing geomap
      var options = {};
      options['region'] = 'GR';
      options['dataMode'] = 'markers';
      options['showLegend'] = 'true';
      options['width'] = '1050px';
      options['height'] = '850px';
      options['colors'] = [0xFF0000,0x990000];
      options['showZoomOut'] = true;
      options['zoomOutLabel'] = " comments";

     
      var geomap
             geomap = new 
google.visualization.GeoMap(document.getElementById('map_canvas'));
              geomap.draw(viewgeo,options);  
     
      google.visualization.events.addListener(geomap,'select',function()
        {
            //get map selection
            var selection = geomap.getSelection();
            //get data of selected state on map
            var row = selection[0].row;
            //format data for a chart
            var regioncode = predata.getValue(row,6);
            {
            window.open('http://apage.com' + regioncode);
        }      
            
            });
        
              
    
}
};
  </script>
</head>

<!-- Presentation Content -->
<h3>comments</h3>
<table >
        <tr>
                <td style="width: 690px;" ><div id='map_canvas'><p><img 
src="http://data-gov.tw.rpi.edu/images/ajax-loader.gif"; alt="loading 
..."></p></div></td>
                </td>
        </tr>
</table>
</center></body>
</html>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/98TWWx_edPkJ.
To post to this group, send email to google-visualization-api@googlegroups.com.
To unsubscribe from this group, send email to 
google-visualization-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to