Wednesday, 17 June 2009

Bar chart in php - Chart in php

$v)
if (abs($v) > $max)
$max = abs($v);

if ($max != 0)
$kf = $height / $max;
else
$kf = 0;

if ($width != '')
$width = "width: {$width}px; ";

$out = "";
foreach($values as $k=>$v)
{
$bar_h = abs(round($v*$kf));
$out .= "";
$out .= "{$v}";
}
$out .= '';


$out .= "";

foreach($values as $k=>$v)
$out .= "{$k}";

$out .= "";
return $out;
}

###########################################################################
function ae_bar_css(&$values, $height=100, $css_prefix='')
{
$max = -1;

foreach($values as $k=>$v)
if (abs($v) > $max)
$max = abs($v);

if ($max != 0)
$kf = $height / $max;
else
$kf = 0;

$out = "";
foreach($values as $k=>$v)
{
$bar_h = abs(round($v*$kf));
$out .= "{$v}";
}
$out .= '';


$out .= "";

foreach($values as $k=>$v)
$out .= "{$k}";

$out .= "";
return $out;
}

#####################################################################################

?>

/////ehter the html title here/////



';
echo ae_bar_css($sinus, 100);
echo '';
?>




And this is the ouput:

No comments:

Post a comment