I'm trying to use Google packages to put together a page, and I'm not able to put a chart and a table on the same page
This is the code for the table
<div id="table_div"></div>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>//USADOPARAAMBOSGRÁFCOS<script>google.charts.load('current',{'packages':['table']});google.charts.setOnLoadCallback(drawTable);functiondrawTable(){vardata2=newgoogle.visualization.DataTable();data2.addColumn('string','Name');data2.addColumn('number','Salary');data2.addColumn('boolean','FullTimeEmployee');data2.addRows([['Mike',{v:10000,f:'$10,000'},true],['Jim',{v:8000,f:'$8,000'},false],['Alice',{v:12500,f:'$12,500'},true],['Bob',{v:7000,f:'$7,000'},true]]);vartable=newgoogle.visualization.Table(document.getElementById('table_div'));table.draw(data2,{showRowNumber:true,width:'30%',height:'30%'});}</script>
Thisisthecodeforthechart
<divid="table_div"></div>
<script>
google.charts.load('current', {packages: ['corechart', 'line']});
google.charts.setOnLoadCallback(drawCurveTypes);
google.charts.load('current', {'packages':['table']});
google.charts.setOnLoadCallback(drawTable);
function drawCurveTypes() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'X');
data.addColumn('number', 'iPhone 16GB');
data.addColumn('number', 'iPhone 32GB');
data.addRows([
[0, 100, 150], [1, 120, 140], [2, 110, 200], [3, 150, 220], [4, 100, 140]
]);
var options = {
title: 'Price variation of iPhone 6s',
curveType: 'none',
legend: { position: 'bottom' },
hAxis: {
title: 'Last 5 days'
},
vAxis: {
title: 'Price in $'
},
series: {
1: {curveType: 'none'}
}
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
On the other hand, if I use the code below I can get two graphics.
google.charts.load('current', {'packages':['table']});
google.charts.setOnLoadCallback(drawTable);
google.charts.setOnLoadCallback(drawTable2);
I'm finding it a problem to load the packages.