Tables, Charts, and Research Reports
google.charts.load(‘current’, {packages: [‘corechart’]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn(‘string’, ‘Label’);
data.addColumn(‘number’, ‘Slices’);
//data.addColumn({type: ‘string’, role: ‘tooltip’, p: {html: true}});
data.addColumn(‘string’, ‘url’);
data.addRows([
[‘Request Parochial Report Data’, 2, ‘/node/264106’],
[‘Forms and Instructions’, 2, ‘/posts/research/forms-and-instructions’],
[‘Studying Your Congregation’, 2, ‘/node/258306’],
[‘Parochial Report Results’, 2, ‘/posts/research/parochial-report-results’],
[‘Congregational Research’, 2, ‘/posts/research/congregational-research’]
]);
// Set chart options
var options = {
chartArea:{left:20,top:0,width:’100%’,height:’100%’},
backgroundColor: ‘none’,
is3D: true,
tooltip: {
trigger: ‘none’
},
pieSliceText: ‘label’,
legend: ‘none’,
fontSize: 14
};
//{ position: ‘labeled’, textStyle: { fontSize: 10 } }
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById(‘chart-menu’));
function selectHandler() {
var selectedItem = chart.getSelection()[0];
if (selectedItem) {
var url = data.getValue(selectedItem.row, 2);
window.location.href = url;
}
}
google.visualization.events.addListener(chart, ‘select’, selectHandler);
chart.draw(data, options);
};