diff --git a/favoris.php b/favoris.php index 287cc8f9e7501ce5e4646798de9315ff887c577d..2e12a74a8cc795acccd905a235c4a69ea0c495ae 100644 --- a/favoris.php +++ b/favoris.php @@ -67,7 +67,10 @@ if (isset($_SESSION["authent"]) && $_SESSION['authent'] == 0){ </table> <?php if ($compt2==1) echo "Pas de favoris <br/><br/><br/>"; ?> - + </div> +</section> +<section class="one" style="background-color:#efefef;"> + <div class="container"> <h2>Mes Favoris</h2> <div class="divider"></div> <table class="table"> @@ -101,8 +104,51 @@ if (isset($_SESSION["authent"]) && $_SESSION['authent'] == 0){ </table> </div> </section> +<section class="one"> + <div class="container"> + <h2>Statistiques</h2> + <div class="divider"></div> + <div id="chartContainer" style="height: 370px; max-width: 920px; margin: 0px auto;"></div> + + </div> +</section> + +<script src="ressources/canvasjs/canvasjs.min.js"></script> +<script> + +var influ = new Array(); +<?php +$result2 = mysqli_query($link, "SELECT nom_artiste, nb_youtube + nb_instagram as nb, tag_instagram FROM influenceurs NATURAL JOIN favoris WHERE nb_youtube != 0 && nb_instagram != 0 && id_user = ".$_SESSION["id"]." ORDER BY nb DESC LIMIT 10"); +while($row = mysqli_fetch_assoc($result2)) :?> + influ.push({y: <?= $row['nb'] ?>,label: '<?= $row['nom_artiste'] ?>'}); +<?php endwhile; ?> + +window.onload = function () { +var chart = new CanvasJS.Chart("chartContainer", { + backgroundColor: "transparent ", + theme: "theme2", + animationEnabled: true, + title:{ + text: "Répartitions des 10 premier favoris" + }, + legend:{ + cursor: "pointer", + }, + data: [{ + type: "doughnut", + innerRadius: 90, + toolTipContent: "<b>{label}</b>: {y} foollowers (#percent%)", + dataPoints: influ, + }] +}); +chart.options.data[0].dataPoints = influ; +chart.render(); + + +} +</script> <?php include "footer.php"