Hmph, just not quite doing the trick... If you'd be so kind here is the
complete source to give you a little bigger picture.  As you can probably
see the point of the script is to generate a bar chart of the array.
Thanks so much for the help, let me know what you think!
-John


<?php
$height = "1";
$width_bar = "25";
$width_spacer = "15";
$color_first = "blue";
$color_second = "red";
$color_third = "green";
$color_fourth = "purple";
$color_fifth = "yellow";

$example_data = array(
array("Mar-99",100,2000,5945.33,1234,10),
array("Feb-99",908,3454,47648.90,4321,50),
array("Jan-99",542,8000,13365.52,6012,60)
);

?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<table width="100" border="0" cellspacing="0" cellpadding="0">

<?php
$high = "47648.90";
if(!isset($num))
{
        $num = 1;
}
while($num <= 100 && $num >= 1)
{

?>

<tr>

<?php
foreach ($example_data as $key=>$value)
{

        $a_color = "0";
        $b_color = "0";
        $c_color = "0";
        $d_color = "0";
        $e_color = "0";

        list($month, $a, $b, $c, $d, $e) = $value;

        $a_percent = ($a / $high) * 100;
        if($a_percent > $num) { $a_color = "1"; }

        $b_percent = ($b / $high) * 100;
        if($b_percent > $num) { $b_color = "1"; }

        $c_percent = ($c / $high) * 100;
        if($c_percent > $num) { $c_color = "1"; }

        $d_percent = ($d / $high) * 100;
        if($d_percent > $num) { $d_color = "1"; }

        $e_percent = ($e / $high) * 100;
        if($e_percent > $num) { $e_color = "1"; }

?>
                <td width="<?php print($width_bar); ?>" height="<?php
print($height);
?>" <?php if($a_color = "1") { ?>bgcolor="<?php print($color_first);
?>"<?php } ?>>&nbsp;</td>
                <td width="<?php print($width_spacer); ?>" height="<?php
print($height);
?>">&nbsp;</td>
                <td width="<?php print($width_bar); ?>" height="<?php
print($height);
?>" <?php if($b_color = "1") { ?>bgcolor="<?php print($color_second);
?>"<?php } ?>>&nbsp;</td>
                <td width="<?php print($width_spacer); ?>" height="<?php
print($height);
?>">&nbsp;</td>
                <td width="<?php print($width_bar); ?>" height="<?php
print($height);
?>" <?php if($c_color = "1") { ?>bgcolor="<?php print($color_third);
?>"<?php } ?>>&nbsp;</td>
                <td width="<?php print($width_spacer); ?>" height="<?php
print($height);
?>">&nbsp;</td>
                <td width="<?php print($width_bar); ?>" height="<?php
print($height);
?>" <?php if($d_color = "1") { ?>bgcolor="<?php print($color_fourth);
?>"<?php } ?>>&nbsp;</td>
                <td width="<?php print($width_spacer); ?>" height="<?php
print($height);
?>">&nbsp;</td>
                <td width="<?php print($width_bar); ?>" height="<?php
print($height);
?>" <?php if($e_color = "1") { ?>bgcolor="<?php print($color_fifth);
?>"<?php } ?>>&nbsp;</td>
                <td width="<?php print($width_spacer); ?>" height="<?php
print($height);
?>">&nbsp;</td>
                <td width="<?php print($width_spacer); ?>" height="<?php
print($height);
?>">&nbsp;</td>
                <td width="<?php print($width_spacer); ?>" height="<?php
print($height);
?>">&nbsp;</td>
<?php
}
?>
        </tr>

<?php
$num = $num + 1;
}
?>

</table>
<?php if($e_percent > 0) { print("1"); } print($e_percent);?>
</body>
</html>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to