I have a problem trying to add a Google chart to my project. The page don't load or loads a blank page. After trying to load it display the page correctly for a few seconds and after that the page goes blank and gets stuck. This my code:
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart','table']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['TEST 1', 3],
['TEST 2', 1],
['TEST 3', 1],
['TEST 4', 1],
['TEST 5', 2]
]);
// Set chart options
var options = {'title':'ACTIONS',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
This is the div I add in the view of the app
<div id="chart_div" style="width:400; height:300"></div>