diff --git a/test-charts.php b/test-charts.php deleted file mode 100644 index f132fb64948234e95df7be556cd0b0a4482f2ceb..0000000000000000000000000000000000000000 --- a/test-charts.php +++ /dev/null @@ -1,86 +0,0 @@ -<!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