romain Rang: Administrateur
Nombre de messages : 346 Date d'inscription : 01/08/2004
| Sujet: fonction de creation d'une jauge Jeu 16 Mar à 0:59 | |
| une jauge avec 4 couleurs differentes selon le pourcentage et un remplissage proportionnel au pourcentage : - Code:
-
function affiche_jauge ($p, $p_max){ $pourc = $p * 100 / $p_max; if ($pourc < 25) $color = "#FF0000"; //rouge elseif ($pourc < 50) $color = "#ff9900"; //orange elseif ($pourc < 75) $color = "#FFFF00"; //jaune else $color = "#00FF00"; //vert echo '<table border=1 width=202 height=8 cellpadding=1 cellspacing=0 bgcolor=0 bordercolor="black">'; echo '<tr><td>'; echo '<table align="center" width=100% height=6 border=0 cellpadding=0 cellspacing=0>'; if ($pourc > 0) echo "<tr><td width=\"$pourc%\" height=6 bgcolor=\"$color\"><font size=1> </font></td>"; echo "<td width=\"100-$pourc%\"bgcolor='#ffffff' height=6></td>"; echo "</tr>"; echo "</table>"; echo "</td></tr>"; echo "</table>"; return $pourc; } | |
|