Ver Mensaje Individual
  #5 (permalink)  
Antiguo 13/04/2010, 10:30
ALONDRA1235
 
Fecha de Ingreso: diciembre-2009
Mensajes: 48
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: Pchart ayudaaaa¡¡¡¡¡¡¡

este es el archivo de pchart.class la linea en rojo es donde esta el problema yano me aparece el error pero no me muestra la imagen ajala m puedas ayudar y de antemano gracias...



/* Color helper */
function AllocateColor($Picture,$R,$G,$B,$Factor=0)
{
$R = $R + $Factor;
$G = $G + $Factor;
$B = $B + $Factor;
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }

return(imagecolorallocate($Picture,$R,$G,$B));
}

/* Render the current picture to a file */
function Render($FileName)
{
if ( $this->ErrorReporting )
$this->printErrors($this->ErrorInterface);
imagepng($this->Picture,$FileName);
}

/* Render the current picture to STDOUT */
function Stroke()
{
if ( $this->ErrorReporting )
$this->printErrors("GD");

header('Content-type: image/png');
imagepng($this->Picture);
}

/* Private functions for internal processing */
function drawAntialiasPixel($X,$Y,$R,$G,$B)
{
if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; }
if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; }
if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; }

$Plot = "";
$Xi = floor($X);
$Yi = floor($Y);

if ( $Xi == $X && $Yi == $Y)
{
/* $this->drawAlphaPixel($Xi,$Yi,0,$R,$G,$B); */
$C_Aliased = imagecolorallocate($this->Picture,$R,$G,$B);
imagesetpixel($this->Picture,$X,$Y,$C_Aliased);
}
else
{
$Alpha1 = (1 - ($X - floor($X))) * (1 - ($Y - floor($Y))) * 100;
if ( $Alpha1 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi,$Alpha1,$R,$G,$B); }

$Alpha2 = ($X - floor($X)) * (1 - ($Y - floor($Y))) * 100;
if ( $Alpha2 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi+1,$Yi,$Alpha2,$R,$G,$B); }

$Alpha3 = (1 - ($X - floor($X))) * ($Y - floor($Y)) * 100;
if ( $Alpha3 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi+1,$Alpha3,$R,$G,$B); }

$Alpha4 = ($X - floor($X)) * ($Y - floor($Y)) * 100;
if ( $Alpha4 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi+1,$Yi+1,$Alpha4,$R,$G,$B); }
}
}

/* Validate data contained in the description array */
function validateDataDescription($FunctionName,&$DataDescri ption,$DescriptionRequired=TRUE)
{
if (!isset($DataDescription["Position"]))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Y Labels are not set.";
$DataDescription["Position"] = "Name";
}

if ( $DescriptionRequired )
{
if (!isset($DataDescription["Description"]))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Series descriptions are not set.";
foreach($DataDescription["Values"] as $key => $Value)
{
$DataDescription["Description"][$Value] = $Value;
}
}

if (count($DataDescription["Description"]) < count($DataDescription["Values"]))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Some series descriptions are not set.";
foreach($DataDescription["Values"] as $key => $Value)
{
if ( !isset($DataDescription["Description"][$Value]))
$DataDescription["Description"][$Value] = $Value;
}
}
}
}

/* Validate data contained in the data array */
function validateData($FunctionName,&$Data)
{
$DataSummary = "";

foreach($Data as $key => $Values)
{
foreach($Values as $key2 => $Value)
{
if (!isset($DataSummary[$key2]))
$DataSummary[$key2] = 1;
else
$DataSummary[$key2]++;
}
}

if ( max($DataSummary) == 0 )
$this->Errors[] = "[Warning] ".$FunctionName." - No data set.";

foreach($DataSummary as $key => $Value)
{
if ($Value < max($DataSummary))
{
$this->Errors[] = "[Warning] ".$FunctionName." - Missing data in serie ".$key.".";
}
}
}

/* Print all error messages on the CLI or graphically */
function printErrors($Mode="CLI")
{
if (count($this->Errors) == 0)
return(0);

if ( $Mode == "CLI" )
{
foreach($this->Errors as $key => $Value)
echo $Value."\r\n";
}
elseif ( $Mode == "GD" )
{
$this->setLineStyle($Width=1);
$MaxWidth = 0;
foreach($this->Errors as $key => $Value)
{
$Position = imageftbbox($this->ErrorFontSize,0,$this->ErrorFontName,$Value);
$TextWidth = $Position[2]-$Position[0];
if ( $TextWidth > $MaxWidth ) { $MaxWidth = $TextWidth; }
}
$this->drawFilledRoundedRectangle($this->XSize-($MaxWidth+20),$this->YSize-(20+(($this->ErrorFontSize+4)*count($this->Errors))),$this->XSize-10,$this->YSize-10,6,233,185,185);
$this->drawRoundedRectangle($this->XSize-($MaxWidth+20),$this->YSize-(20+(($this->ErrorFontSize+4)*count($this->Errors))),$this->XSize-10,$this->YSize-10,6,193,145,145);

$C_TextColor = imagecolorallocate($this->Picture,133,85,85);
$YPos = $this->YSize - (18 + (count($this->Errors)-1) * ($this->ErrorFontSize + 4));
foreach($this->Errors as $key => $Value)
{
imagettftext($this->Picture,$this->ErrorFontSize,0,$this->XSize-($MaxWidth+15),$YPos,$C_TextColor,$this->ErrorFontName,$Value);
$YPos = $YPos + ($this->ErrorFontSize + 4);
}
}
}

/* Convert seconds to a time format string */
function ToTime($Value)
{
$Hour = floor($Value/3600);
$Minute = floor(($Value - $Hour*3600)/60);
$Second = floor($Value - $Hour*3600 - $Minute*60);

if (strlen($Hour) == 1 ) { $Hour = "0".$Hour; }
if (strlen($Minute) == 1 ) { $Minute = "0".$Minute; }
if (strlen($Second) == 1 ) { $Second = "0".$Second; }

return($Hour.":".$Minute.":".$Second);
}

/* Convert to metric system */
function ToMetric($Value)
{
$Go = floor($Value/1000000000);
$Mo = floor(($Value - $Go*1000000000)/1000000);
$Ko = floor(($Value - $Go*1000000000 - $Mo*1000000)/1000);
$o = floor($Value - $Go*1000000000 - $Mo*1000000 - $Ko*1000);

if ($Go != 0) { return($Go.".".$Mo."g"); }
if ($Mo != 0) { return($Mo.".".$ko."m"); }
if ($Ko != 0) { return($Ko.".".$o)."k"; }
return($o);
}

/* Set date format for axis labels */
function setDateFormat($Format)
{
$this->DateFormat = $Format;
}

/* Convert TS to a date format string */
function ToDate($Value)
{
return(date($this->DateFormat,$Value));
}
}

function RaiseFatal($Message)
{
echo "[FATAL] ".$Message."\r\n";
exit();
}
?>