Re: Graficos en PHP - se puede pero no deja poner datos al inicio
| From: | FERNANDO ZAPATA | Date: | Fri, 13 Jan 2006 01:25:35 +0000 |
| Subject: | Re: Graficos en PHP - se puede pero no deja poner datos al inicio | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-57255@lists.php.net to get a copy of this message | ||
adjunto el ejemplo pasandole un array.. ahora si tengo mi apache con mi php
y lo probe y funciona bien lo unico q deberias cambiarle el include al
jpgraph.
saludos Fernando A. Zapata Miranda
Lima-Peru
//archivo 1 : pagina.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>formulario</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
//generamos una array cualquiera
$miArray=array(4,5,6,7,5,2);
$variable=serialize($miArray);
?>
<body>
<img src="imagen.php?miArray=<?=$variable?>" border="0"
width="300"
height="200">
</body>
</html>
//pagina 2 : imagen.php
<?php
include ("jpgraph/src/jpgraph.php");
include ("jpgraph/src/jpgraph_bar.php");
$tmp=unserialize($_REQUEST["miArray"]);
$datay=array($tmp[0],$tmp[1],$tmp[2],$tmp[3],$tmp[4],$tmp[5]);//array de
datos q se recibe del form
$graph = new Graph(300,200,"auto");
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(40,30,20,40);
$bplot = new BarPlot($datay);
$bplot->value->Show();
$graph->Add($bplot);
$graph->title->Set("grafica de barras");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->Stroke();
?>