Hallo,
ich würde gerne eine Statistik in form eines Balkendiagramms machen.
Hat jemand eine Ahnung wie sowas geht?
MFG
ich würde gerne eine Statistik in form eines Balkendiagramms machen.
Hat jemand eine Ahnung wie sowas geht?
MFG
function ShowRating ($rate,$bar_width=40){
$bar_height = 10;
$bar_out_color = "#C0C0C0";
$bar_out_color = "#000000";
$bar_in_color = "#ff0000";
$bar_in_high_color = "#fF0000";
$bar_in_width = $rate*10;
$bar_in_height = $bar_height-1;
if($bar_in_width >= 80) {
$bar_incolor=$bar_in_high_color;
} else {
$bar_incolor=$bar_in_color;
}
$rateBar= "<div align=\"right\"><table border=0 cellspacing=0 cellpadding=1 width=\"$bar_width\" height=\"$bar_height\">\n";
$rateBar.=" <tr>\n";
$rateBar.=" <td style=\"background-color: $bar_out_color\">\n";
$rateBar.=" <table align=left border=0 cellspacing=0 cellpadding=0 width=\"$bar_in_width%\" height=\"$bar_in_height\">\n";
$rateBar.=" <tr>\n";
$rateBar.=" <td style=\"background-color: $bar_incolor\">\n";
$rateBar.=" <table><tr><td></td></tr></table>\n";
$rateBar.=" </td>\n";
$rateBar.=" </tr>\n";
$rateBar.=" </table>\n";
$rateBar.=" </td>\n";
$rateBar.=" </tr>\n";
$rateBar.="</table></div>\n";
return $rateBar;
}
$strSQL = "SELECT count(p.pk_peripheral) as pCount, a.name FROM ";
$strSQL .= "Abteilung as a, peripherals as p, peripheral_types as pt WHERE pt.peripheral_pk=p.peripheral_fk AND p.abteilung_fk=a.id_abteilung ";
$strSQL .= "GROUP BY a.id_abteilung";
$result = dbquery($strSQL);
echo "<font color='Peru'>Peripherals:</font>";
echo "<br>";
While ($row = mysql_fetch_array($result)){
echo "<font size='-1'> ".$row["name"]."</font>";
echo "<font size='-1'> ".$row["pCount"]."</font>";
function ShowRating ($pCount,$bar_width=40); <-------------- HIER FEHLER
echo " <br> ";}
echo"<font size='-1'><center><a href=details_peripherals.php>Detailed View</a></center></font>";
While ($row = mysql_fetch_array($result)){
echo "<font size='-1'> ".$row["name"]."</font>";
echo "<font size='-1'> ".$row["pCount"]."</font>";
function ShowRating ($row["pCount"]);
echo " <br> ";}
While ($row = mysql_fetch_array($result)){
echo "<font size='-1'> ".$row["name"]."</font>";
echo "<font size='-1'> ".$row["pCount"]."</font>";
echo ShowRating ($row["pCount"]);
echo " <br> ";}
Kommentar