From d73e3ea8d04c52f9ede2de363b14bdbdb910f45d Mon Sep 17 00:00:00 2001 From: Pascal Corpet Date: Mon, 17 Jan 2005 00:03:24 +0000 Subject: [PATCH] graph by promo : maintenant en pourcentage git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-364 --- htdocs/stats/graph_by_promo.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/stats/graph_by_promo.php b/htdocs/stats/graph_by_promo.php index 0595b7b..fe54ddf 100644 --- a/htdocs/stats/graph_by_promo.php +++ b/htdocs/stats/graph_by_promo.php @@ -29,18 +29,15 @@ $depart = 1920; //recupere le nombre d'inscriptions par jour sur la plage concernée $res = $globals->xdb->iterRow( - "SELECT IF (promo < $depart, ".($depart-1).", promo) AS annee,COUNT(user_id) + "SELECT promo, SUM(perms IN ('admin', 'user')) / COUNT(*) * 100 FROM auth_user_md5 - WHERE promo >= $depart AND perms IN ('admin','user') - GROUP BY annee"); + WHERE promo >= $depart AND deces = 0 + GROUP BY promo"); //genere des donnees compatibles avec GNUPLOT $inscrits=''; // la première ligne contient le total des inscrits avant la date de départ -list(,$init_nb) = $res->next(); -$total = $init_nb; - list($annee, $nb) = $res->next(); for ($i=$depart;$i<=date("Y");$i++) { @@ -50,7 +47,6 @@ for ($i=$depart;$i<=date("Y");$i++) { $nb = 0; } } - if ($nb > $total) $total = $nb; if ($nb > 0 || $i < date("Y")) $inscrits .= $i." ".$nb."\n"; } @@ -58,8 +54,10 @@ for ($i=$depart;$i<=date("Y");$i++) { //Genere le graphique à la volée avec GNUPLOT header( "Content-type: image/png"); -$ymin = round($init_nb*0.95,0); -$ymax = round($total *1.05,0); +$ymin = 0; +$ymax = 100; + +$fin = $i+10; $gnuplot = <<