No, don't do that. There are a couple things wrong with this method:
first, the Google loader needs to have its callback set before it returns
data, otherwise the callback never fires; second, by calling
drawChart($FrameResults), you are actually calling the function immediately
and passing its return value (presumably null) to the callback handler.
This accomplishes none of what is necessary to protect against premature
drawing. You need to set up the code like this:
jQuery.noConflict();
function init () {
/* set up code that initializes your AJAX calls first (in this
function),
* so none of them can be made before the Visualization API is loaded
* then set up the AJAX response handler
*/
(function($) {
$( document ).ajaxComplete(function() {
drawChart($FrameResults);
});
}(jQuery));
}
google.setOnLoadCallback(init);
On Sunday, December 8, 2013 5:03:32 AM UTC-5, Rob van Eck wrote:
>
> Thank you, you've put me on the right track!
>
> To load the graph i now use:
>
> <script type="text/javascript">
>
> jQuery.noConflict();
> (function($) {
> $( document ).ajaxComplete(function() {
> google.setOnLoadCallback(drawChart($FrameResults));
> });
> }(jQuery));
>
> </script>
>
> Now the legend is perfect
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.