This is likely due to a quirk in the google loader. When the google loader
is called from within another function, it changes its behavior, and the
most commonly used method of assigning a callback (via
google.setOnLoadCallback) doesn't work. If you change the way the callback
is assigned to set it directly in the google.load call, it should work.
Here's a proof-of-concept:
$(function () {
$.getScript('http://www.google.com/jsapi', function(data, textStatus,
jqxhr) {
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('number', 'Value');
data.addRows([
['Foo', 3],
['Bar', 6],
['Baz', 4]
]);
var chart = new
google.visualization.PieChart(document.querySelector('#chart_div'));
chart.draw(data, {
height: 400,
width: 600
});
}
google.load('visualization', '1', {packages:['corechart'],
callback: drawChart});
});
});
see it working here: http://jsfiddle.net/asgallant/6kLQj/
On Friday, November 15, 2013 3:33:49 AM UTC-5, Xavier Palacín Ayuso wrote:
>
> Hi,
>
> I need to load the script of Google Chart -> Org Charts (orgchart):
> <script type='text/javascript' src='https://www.google.com/jsapi
> '></script>
>
> My problem is that, I use a framework and only can load JavaScript files
> from resourcer directory (/resources/js) calling framework API method to
> load JavaScripts.
> I test 2 cases:
>
> 1. Get JavaScript content from https://www.google.com/jsapi and put on
> a file jsap.js and move to /resources/js/jsap.js and load with a framework
> API method to load JavaScripts, the result is, when load a script pages
> goes to white page and remains loading and waiting fro www.google.com.
> 2. Load script with jQeury method getScript(), I pass the url
> paremeter and in callback puts Org Charts load, and the result is the same
> as case 1: when load a script pages goes to white page and remains loading
> and waiting fro www.google.com.
>
> I read a FAQ and see that google don't allow to use charts offline or
> download the chart code local.
>
> Thanks
>
>
--
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.