Foros del Web » Programando para Internet » PHP »

Pchart ayuda¡

Estas en el tema de Pchart ayuda¡ en el foro de PHP en Foros del Web. HOLA OJAJA ALGUIEN M PUEDA AYUDAR TRATO DE HACER UNA GRAFICA CON PCHART PERO NO PUEDO VER LA IMAGEN Q SE GENERA EL ERROR ES ...
  #1 (permalink)  
Antiguo 13/04/2010, 09:20
 
Fecha de Ingreso: diciembre-2009
Mensajes: 48
Antigüedad: 14 años, 4 meses
Puntos: 0
Pchart ayuda¡

HOLA OJAJA ALGUIEN M PUEDA AYUDAR TRATO DE HACER UNA GRAFICA CON PCHART PERO NO PUEDO VER LA IMAGEN Q SE GENERA EL ERROR ES EL SIG:

Warning: imagepng() [function.imagepng]: Unable to open 'example10.png' for writing: Permission denied in /home/a5448150/public_html/Graficos/pChart/pChart.class on line 3183

ESTE ES EL EJEMPLO:

<?php
/*
Example10 : A 3D exploded pie graph
*/

// Standard inclusions
include("pChart/pData.class");
include("pChart/pChart.class");

// Dataset definition
$DataSet = new pData;
$DataSet->AddPoint(array(10,2,3,5,3),"Serie1");
$DataSet->AddPoint(array("January","February","March","Ap ri l","May"),"Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");

// Initialise the graph
$Test = new pChart(420,250);
$Test->drawFilledRoundedRectangle(7,7,413,243,5,240,24 0, 240);
$Test->drawRoundedRectangle(5,5,415,245,5,230,230,230) ;
$Test->createColorGradientPalette(195,204,56,223,110,4 1, 5);

// Draw the pie chart
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->AntialiasQuality = 0;
$Test->drawPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),180,130,110,PIE_PERCENTAGE _L ABEL,FALSE,50,20,5);
$Test->drawPieLegend(330,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250);

// Write the title
$Test->setFontProperties("Fonts/MankSans.ttf",10);
$Test->drawTitle(10,20,"Sales per month",100,100,100);

$Test->Render("example10.png");
?>

TENGO EL EJEMPLO Y LAS CARPETAS PCHART EN EL MISMO LUGAR
OJALA ALGUIEN M PUEDA AYUDAR GRACIAS...
  #2 (permalink)  
Antiguo 13/04/2010, 09:30
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: Pchart ayudaaaa¡¡¡¡¡¡¡

Permission denied in...

permiso denegado en...

prueba modificando los permisos de la carpeta y archivos asociados a 777 y nos comentas
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #3 (permalink)  
Antiguo 13/04/2010, 09:39
 
Fecha de Ingreso: diciembre-2009
Mensajes: 48
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: Pchart ayudaaaa¡¡¡¡¡¡¡

Hola kaninox gracias x tu interes

T parasera tonto pero es la primera vez q hago un proyecto con php y pchar podrias ser un poco mas explicito en donde cambiar los permisos
tengo laqs siguientes carpetas
pchart
cache
Fonts
Sample

gracias...
  #4 (permalink)  
Antiguo 13/04/2010, 09:52
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: Pchart ayudaaaa¡¡¡¡¡¡¡

segun lo que marca tu error te dice :

Graficos/pChart/pChart.class

asi que prueba cambiando los permisos de pChart y del archivo pChart.class
ya si te falla el sistema te ira diciendo que archivos estan bloqueados. seguro quieres subir alguna imagen y esta no te deja.

Saludos
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #5 (permalink)  
Antiguo 13/04/2010, 10:30
 
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();
}
?>
  #6 (permalink)  
Antiguo 13/04/2010, 11:08
 
Fecha de Ingreso: diciembre-2009
Mensajes: 48
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: Pchart ayudaaaa¡¡¡¡¡¡¡

problema resuelto si eran los permisos q tenia q cambiar a 777 gracias por la orientacion¡¡¡

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:42.