In this map, we use data from States ( see the spreadsheet ) and this too can be mapped into a map of India. However state level maps are not available and the data for a particular state is mapped into a point ( or marker) in the state.
Once again we observe the limitations of not being able to show more than two data points for each state.
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages': ['geochart']});
google.setOnLoadCallback(drawMarkersMapTR);
function drawMarkersMapTR() {
var query = new google.visualization.Query(
'https://docs.google.com/a/yantrajaal.com/spreadsheet/ccc?key=xxxxxxxxxxxxxx&sheet=MilkProduction&range=B2:H37&headers=1');
query.setQuery('select B,C,D');
query.send(handleQueryResponseTR);
};
function handleQueryResponseTR(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var options = {
region: 'IN',
displayMode: 'markers',
width : 600,
height : 400
};
var data = response.getDataTable();
var chart = new google.visualization.GeoChart(document.getElementById('chart_divTR'));
chart.draw(data, options );
}
</script>
</head>
<body>
<div id="chart_divTR"></div>
</body>
No comments:
Post a Comment