Hi,
I would like to add in a dashboard a map where the coordonates are
available in google spreadsheet. I've tried the following code, but
it does not work.
<script type="text/javascript" src="
http://www.google.com/jsapi"></
script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['controls',
'corechart', 'table','map']});
</script>
<script type="text/javascript">
var visualization;
function drawVisualization() {
// Prepare the data
var query = new google.visualization.Query('https://
docs.google.com/spreadsheet/ccc?
key=0At7FLhuT06-0dDdWaWpkakI2ZjJybjFDWVJ4TFNUQXc&hl=en_GB#gid=0');
query.setQuery('SELECT
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,AA,AB,AC,AD');
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var CityPicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control2',
'options': {
'filterColumnLabel': 'City',
'ui': {
'labelStacking': 'vertical',
'allowTyping': false,
'allowMultiple': false
}
},
'state': {'selectedValues': ['Monaco']}
});
var CountryPicker = new
google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control1',
'options': {
'filterColumnLabel': 'Country',
'ui': {
'labelStacking': 'vertical',
'allowTyping': false,
'allowMultiple': false
}
},
'state': {'selectedValues': ['Monaco']}
});
var table1 = new google.visualization.ChartWrapper({
'chartType': 'Table',
'containerId': 'table1',
'options': {
'width': '920px',
'height': 53
}, 'view': {'columns': [0,18,1,15,16,17] ,'rows': [0] }
});
var line1 = new google.visualization.ChartWrapper({
'chartType': 'LineChart',
'containerId': 'chart6',
'options': {
'width': 475,
'height': 220,
'legend': 'none',
'pointSize': 7,
'title': 'Number of movements',
'chartArea': {'left': 100, 'top': 30,
'width':'60%','height':'70%'},
'vAxis': {'minValue': 0}
},
'view': {'columns': [2,14],'rows': [0,1,2] }
});
// Define a map
var geodata = response.getDataTable();
datalat = geodata.getValue(1, 19); // Latitude of the
succursale
datalon = geodata.getValue(1, 20); // Longitude of the
succursale
var map1 = new
google.visualization.Map(document.getElementById('map1'));
//map1.setCenter(new GLatLng(datalat, datalon), 13);
new
google.visualization.Dashboard(document.getElementById('dashboard')).
// Establish bindings, declaring the both the slider and
the category
// picker will drive both charts.
bind(CountryPicker, CityPicker).
bind([CityPicker], [table1, line1, map1]).
// Draw the entire dashboard.
draw(data);
draw(geodata);
}
google.setOnLoadCallback(drawVisualization)
thanks,