Hi there,
my code follows and I am trying to display a geochart with
ISO-3166-2 codes of Greece eg GR-A, GR-K but what I only see is a world map with no colors and nothing else.
Is there a bug, or am I missing something?
thanks
<script type="text/javascript">
google.load("visualization", "1", {packages:["geochart"]});
google.setOnLoadCallback(setupData);
var newData = null;
var viewgeomap = null;
var map = null;
///////////////////////////////
// Function setupData
// Initializes the query and service to pull the data
///////////////////////////////
function setupData()
{
//SPARQL endpoint we will use to query the datasets
//this is where the actual SPARQL query is stored
//url that will execute the query
//construct the query
var query = new google.visualization.Query(queryurl);
//send query with callback function
query.send(handleQueryResponse);
};
///////////////////////////////
// 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 predata = response.getDataTable();
var vals = new Array();
var rownum = predata.getNumberOfRows();
// Make sure our data isn't empty.
if (null==predata)
return;
//Get all available data coming from Q
var newdata =new google.visualization.DataTable();
newdata.addColumn('string', 'CODE_3166');
newdata.addColumn('string', 'example1');
newdata.addColumn('number', 'example2');
newdata.addColumn('number', 'example3');
newdata.addColumn('number', 'example4');
newdata.addRows(newdata.getNumberOfRows());
for (var i = 0; i < rownum; i++ )
{
var CODE_3166 = predata.getValue(i,0);
var example1 =predata.getValue(i,1);
var example2 =predata.getValue(i,2);
var example3 =predata.getValue(i,3);
var example4 =predata.getValue(i,4);
vals [0] = CODE_3166;
vals [1] = example1+"<br />example2: "+example2+"<br />example3: "+example3;
vals [2] = example2;
vals [3] = example3;
vals [4] = example4;
newdata.addRow(vals);
viewmap = new google.visualization.DataView( newdata );
viewmap.setColumns([0, 1]);
}
var options = {};
//Now draw the map using this viewmap as a customized data table:
geomap = new google.visualization.GeoChart(document.getElementById('visualization_Map'));
geomap.draw(viewmap, options);
};
</script>
</head>
<body>
<!-- Presentation Content -->
<table >
<tr>
<td style="width: 950px;" >
</td>
</div>
</td>
</tr>
</table>
</body>
</html>