You need to make sure that the API is loaded first, but otherwise, this should work fine. Something like this would do the trick:
google.load('visualization', '1', {'packages': ['corechart']});
google.setOnLoadCallback(init);
function init () {
document.getElementById('myButton').onclick = function () {
// draw the chart here, or call chart drawing function
};