Created
April 5, 2012 18:26
-
-
Save taytus/2313063 to your computer and use it in GitHub Desktop.
Get events working with GoogleCharts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function drawVisualization() { | |
// Create and populate the data table. | |
var data = new google.visualization.DataTable(); | |
data.addColumn('string', 'Task'); | |
data.addColumn('number', 'Hours per Day'); | |
data.addRows(5); | |
data.setValue(0, 0, 'Work'); | |
data.setValue(0, 1, 11); | |
data.setValue(1, 0, 'Eat'); | |
data.setValue(1, 1, 2); | |
data.setValue(2, 0, 'Commute'); | |
data.setValue(2, 1, 2); | |
data.setValue(3, 0, 'Watch TV'); | |
data.setValue(3, 1, 2); | |
data.setValue(4, 0, 'Sleep'); | |
data.setValue(4, 1, 7); | |
// Create and draw the visualization. | |
var pie=new google.visualization.PieChart(document.getElementById('visualization')); | |
pie.draw(data, {title:"So, how was your day?"}); | |
google.visualization.events.addListener(pie, 'select', selectHandler); | |
} | |
function selectHandler() { | |
alert("hi"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment