Flordeni02 de Julio del 2004
Pregunta
Hola, Quiesiera saber codigo para crear graficas ya sea de barras, pastel, etc en PHP. Los datos para generar la grafica estan en mysql, es una Base de Datos. Agradeceria si me pudieran ayudar.
art02 de Julio del 2004
checate esto
<?php
//Creeado por R2ro75
// Crea la imagen
$image = imagecreate(200, 200);
// Creea los colores
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
$darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90);
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);
$darknavy = imagecolorallocate($image, 0x00, 0x00, 0x50);
$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);
$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);
$black = imagecolorallocate($image, 0,0,0);
// Creea efecto 3D
for ($i = 60; $i > 50; $i--) {
imagefilledarc($image, 50, $i, 100, 50, 0, 45, $darknavy, IMG_ARC_PIE);
imagefilledarc($image, 50, $i, 100, 50, 45, 75 , $darkgray, IMG_ARC_PIE);
imagefilledarc($image, 50, $i, 100, 50, 75, 360 , $darkred, IMG_ARC_PIE);
}
imagefilledarc($image, 50, 50, 100, 50, 0, 45, $navy, IMG_ARC_PIE);
imagestring($image,4,70,90,'one',$black );
imagefilledarc($image, 50, 50, 100, 50, 45, 75 , $gray, IMG_ARC_PIE);
imagestring($image,4,0,90,'Two',$black );
imagefilledarc($image, 50, 50, 100, 50, 75, 360 , $red, IMG_ARC_PIE);
imagestring($image,4,100,30,'Three',$black );
// flush image
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>
saludos
flordeni02 de Julio del 2004
Gracias por el codigo, pero tambien quiero jalar los datos que tengo en mysql y generar los graficos estadisticos, como le hago? Gracias