Skip to content
Snippets Groups Projects
Commit 8655021f authored by Aldo Gonzalez-Lorenzo's avatar Aldo Gonzalez-Lorenzo
Browse files

Remove old file

parent bb92490a
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>SAÉ 303</title>
</head>
<body>
<div id="piechart_div"></div>
<div id="barchart_div"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script>
const httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = () => {
if (httpRequest.readyState === XMLHttpRequest.DONE) {
if (httpRequest.status === 200) {
console.debug(result)
const response = JSON.parse(httpRequest.responseText);
console.debug(result)
google.charts.load("current", { "packages": ["corechart"], "language": "fr" })
google.charts.setOnLoadCallback(function() {
drawChart(response)
})
} else {
// There was a problem with the request.
// For example, the response may have a 404 (Not Found)
// or 500 (Internal Server Error) response code.
}
} else {
// Not ready yet.
}
};
httpRequest.open('GET', 'include/php/data.php', true);
query = "SELECT acad_mies, sum(capa_fin) AS places FROM parcoursup GROUP BY acad_mies ORDER BY places DESC"
httpRequest.send(`query=${encodeURIComponent(query)}`);
// $(document).ready(function() {
// $.ajax({
// url: "include/php/data.php",
// method: "GET",
// data: {
// "query": "SELECT acad_mies, sum(capa_fin) AS places FROM parcoursup GROUP BY acad_mies ORDER BY places DESC"
// },
// dataType: "JSON",
// success: function(result) {
// console.debug(result)
// google.charts.load("current", { "packages": ["corechart"], "language": "fr" })
// google.charts.setOnLoadCallback(function() {
// drawChart(result)
// })
// }
// })
// function drawChart(result) {
// let data = new google.visualization.DataTable()
// data.addColumn('string', 'Académie')
// data.addColumn('number', 'Places')
// let dataArray = []
// for (const item of result) {
// dataArray.push([item.acad_mies, Number(item.places)])
// }
// data.addRows(dataArray)
// let piechart_options = {
// title: 'Pie Chart : Nombre de places dans chaque académie',
// width: 600,
// height: 400
// }
// let piechart = new google.visualization.PieChart(document.getElementById('piechart_div'))
// piechart.draw(data, piechart_options)
// let barchart_options = {
// title: 'Barchart : Nombre de places dans chaque académie',
// width: 600,
// height: 800,
// legend: 'none'
// }
// let barchart = new google.visualization.BarChart(document.getElementById('barchart_div'))
// barchart.draw(data, barchart_options)
// }
// })
</script>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment