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
};
}
On Thursday, May 3, 2012 1:27:20 PM UTC-4, Panayiotis Papadopoulos wrote:
>
> Hi everyone, I am trying to draw a GeoChart but I don't want it to load on
> page load. I want to draw the graph only if the user clicks on a button and
> fetch some data with AJAX. Unfortunately it fails. It seems that
> google.visualization.arrayToDataTable is missing.
>
> Do you have any tips on how to draw the data only after the page is loaded.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/GGLMHERTiSAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.