function drawVisualization() {
// Prepare the data
var dataShow = google.visualization.arrayToDataTable([
['Year' 'Month' 'Category' 'Value'],
['2014', 'January' 'Shop' 456],
['2014', 'February' 'Rent' 234],
['2014', 'March' 'Rent' 456],
['2014', 'April' 'Other' 234],
['2013', 'January' 'Rent' 222],
['2013', 'February' 'Other' 123]
]);
// Define a category picker control for the Year column
categoryPickerYear = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'controlYear',
'options': {
'filterColumnLabel': 'Year',
'ui': {
'labelStacking': 'vertical',
'allowTyping': false,
'allowMultiple': true
}
}
});
// Define a category picker control for the Month column
categoryPickerMonth = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'controlMonth',
'options': {
'filterColumnLabel': 'Month',
'ui': {
'labelStacking': 'vertical',
'allowTyping': false,
'allowMultiple': true
}
}
});
// Define a Pie chart
range = Array.apply(null, Array(5)).map(function (_, i) {return i;});
pieInc = new google.visualization.ChartWrapper({
'chartType': 'PieChart',
'containerId': 'PieChartInc',
'options': {
'width': 400,
'height': 400,
'legend': 'none',
'title': 'Donuts eaten per person',
'chartArea': {'left': 15, 'top': 15, 'right': 0, 'bottom': 0},
'pieSliceText': 'label'
},
// Instruct the piechart to use colums 2 and 3 ()
// from the 'data' DataTable.
'view': {'columns': [2,3]}
});
// Create a dashboard
dashboard = new google.visualization.Dashboard(document.getElementById('dashboard'));
// Establish bindings, declaring the both the slider and the category
// picker will drive both charts.
dashboard.bind(categoryPickerYear,categoryPickerMonth);
dashboard.bind(categoryPickerMonth,[pieInc,pieExp]);
// Draw the entire dashboard.
dashboard.draw(dataShow);
}