Here the script :
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript"
src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages: ["corechart", "geochart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart(){
var data1 = google.visualization.arrayToDataTable(
$.ajax({
url: "life_expectancy_continent.php",
async: false
}).responseJSON
);
var options1 = {
title: "Espérance de vie par continent (en %)",
};
var chart1 = new
google.visualization.BarChart(document.getElementById('Barchart'));
chart1.draw(data1,options1);
var data2 = google.visualization.arrayToDataTable(
$.ajax({
url: "surface_population.php",
async: false
}).responseJSON
);
var options2 = {
title: "Surface d'un continent (en m²) en fonction de sa population",
hAxis: {title:'Surface (en m²)'},
vAxis: {title:'Population du continent'}
}
var chart2 = new
google.visualization.ScatterChart(document.getElementById('scatterplot'));
chart2.draw(data2,options2);
var data3 = google.visualization.arrayToDataTable(
$.ajax({
url: "life_expectancy.php",
async: false
}).responseJSON
);
var options3 = {title:"Carte du monde de l'espérance de vie (par
pays)"};
var chart3 = new
google.visualization.GeoChart(document.getElementById('map'));
chart3.draw(data3, options3);
var data4 = google.visualization.arrayToDataTable(
$.ajax({
url: "life_expectancy_population_PNB.php",
async: false
}).responseJSON
);
var options4 = {
title: "Corrélation entre l'espérance de vie et le produit national
brut et la population d'un pays",
hAxis: {title: 'Life Expectancy'},
vAxis: {title: 'Fertility Rate'},
bubble: {textStyle: {fontSize: 11}}
};
var chart4= new
google.visualization.BubbleChart(document.getElementById('bbl_c'));
chart4.draw(data4, options4);
}
</script>
</head>
<body>
<div id="Barchart" style="width: 900px; height: 500px;"></div>
<div id="scatterplot" style="width: 900px ; height: 500px;"></div>
<div id="map" style="width: 900px; height: 500px;"></div>
<div id="bbl_c" style="width: 900px; height: 500px;"></div>
</body>
</html>
Le samedi 13 mars 2021 à 11:34:32 UTC+1, Jérôme a écrit :
> Hello,
>
> I needed to code a webpage with graphics using Google chart linked with a
> database and I get to display a webpage with the first graphic I coded but
> when I added a 2nd graphic, nothing at all happen even the first graphic I
> saw before didn't appear. The same when I added other graphics between
> JavaScript tag. I tried to fix it but I don't know where is the problem. I
> don't think the problem come from my.php files. Anyone can see the problem
> in my Google chart code?
>
> Thank you!
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/d7669f65-f96e-4d6b-afbd-afab28b36bd9n%40googlegroups.com.