I'm using the Google javascript function to try to make a pie chart. It works fine as a fiddle: http://jsfiddle.net/qb8av4td/.
But when I copy it into my own webpage, it doesn't work. I'll I'm doing is adding <script type="text/javascript"> and </script> around the javascript section. It's easier if I can put both of the two script sections in the body, but I've tried the conventional head/body approach as well, and I can't get it to execute. The problem is the same on two browsers, and java is working elsewhere on my site. What have I done to prevent it from executing here? Thanks!
<html>
<head>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Truth or Falsity', 'Judgment!'],
['True', 28],
['False', 8],
['Partly True, Partly False', 69],
['N/A', 13],
]);
var options = {
title: 'The True Science of "Ithaca"'
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}"></script>
<div id="piechart" style="width: 400px; height: 300px;"></div>
</body>
</html>