Hi, I'm a Acucobol software developer trying to reply wonderful Google Chart example showned in the gallery.
I've written 'my' own code, but it does not work (of course).
Can someone give a fresh look to the following code and report which are and correcting mistakes lines?
Thank you for your kind help.
<html>
<head>
<script type="text/javascript">
google.charts.load('current', {'packages':['line']});
// Can I gather these 2 frases together?
google.charts.load("current", {packages:["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'Day');
data.addColumn('number', 'Guardians of the Galaxy');
data.addColumn('number', 'The Avengers');
data.addColumn('number', 'Transformers: Age of Extinction');
data.addRows([
[1, 37.8, 80.8, 41.8],
[2, 30.9, 69.5, 32.4],
[3, 25.4, 57, 25.7],
[4, 11.7, 18.8, 10.5],
]);
var options = {
chart: {
title: 'Box Office Earnings in First Two Weeks of Opening',
subtitle: 'in millions of dollars (USD)'
},
width: 900,
height: 500,
axes: {
x: {
0: {side: 'bottom'}
}
}
};
var chart = new google.charts.Line(document.getElementById('line_top_x'));
chart.draw(data, options);
// Code pasted from Pie Donut example
var data2 = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 11],
['Eat', 2],
['Commute', 2],
['Watch TV', 2],
['Sleep', 7]
]);
var options2 = {
title: 'My Daily Activities',
pieHole: 0.4,
colors: ['#CC0000', '#999999', '#EEEEEE', '#FF9999', 'red'],
};
var chart2 = new google.visualization.PieChart(document.getElementById('donutchart'));
chart2.draw(data2, options2);
}
</script>
</head>
<body>
<td>Hello World! </td>
<div id="line_top_x"></div>
<td>
<div id="donutchart" style="width: 900px; height: 500px;"></div>
</td>
</body>
</html>