I am trying to embed a table and a map in my website. I have found out how to make the table with filters. But I have problems making the map work as well.
<script type="text/javascript">
google.load('visualization', '1.0', {'packages':['controls', 'table', 'map']});
google.setOnLoadCallback(drawDashboard);
function drawDashboard() {
query.setQuery('SELECT A,B,C,D,E,F,G,H,I,J,K,L');
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var dashboard = new google.visualization.Dashboard(
document.getElementById('dashboard_div'));
var filter = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control1',
'options': {
'filterColumnLabel': 'År',
'ui': {
'allowTyping': false,
'allowMultiple': true,
'selectedValuesLayout': 'belowWrapping',
'labelStacking': 'vertical',
'caption': 'Vælg et år'
}
}
});
var filter2 = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control2',
'options': {
'filterColumnLabel': 'Køn',
'ui': {
'allowTyping': false,
'allowMultiple': true,
'selectedValuesLayout': 'belowWrapping',
'labelStacking': 'vertical',
'caption': 'Vælg køn'
}
}
});
var filter3 = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control3',
'options': {
'filterColumnLabel': 'Element',
'ui': {
'allowTyping': false,
'allowMultiple': true,
'selectedValuesLayout': 'belowWrapping',
'labelStacking': 'vertical',
'caption': 'Vælg element'
}
}
});
var filter4 = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control4',
'options': {
'filterColumnLabel': 'Modpart',
'ui': {
'allowTyping': false,
'allowMultiple': true,
'selectedValuesLayout': 'belowWrapping',
'labelStacking': 'vertical',
'caption': 'Vælg modpart'
}
}
});
var table = new google.visualization.ChartWrapper({
'chartType': 'Table',
'containerId': 'chart2',
'options': {
'width': '900px',
'height': '1200px'
}
});
var map1 = new google.visualization.ChartWrapper({
'chartType': 'Map',
'containerId': 'map1',
'view': { 'columns': [8, 9]}
});
dashboard.bind([filter, filter2, filter3, filter4], [table, map1]);
dashboard.draw(data);
}
</script>
<p> </p>
<!--Div that will hold the dashboard-->
<div id="dashboard_div">
<!--Divs that will hold each control and chart-->
<div id="control1"></div>
<div id="control2"></div>
<div id="control3"></div>
<div id="control4"></div>
<div id="chart2"></div>
<div id="map1"></div>
</div>