Ver Mensaje Individual
  #10 (permalink)  
Antiguo 22/08/2006, 15:06
nav2003
 
Fecha de Ingreso: enero-2003
Ubicación: Santiago
Mensajes: 301
Antigüedad: 21 años, 3 meses
Puntos: 1
tomar datos de BD y formar grafico

Hola amigos he utilizado el jpgraph, funciona bien, sin embargo yo quiero extraer datos estadisticos de mis visitas de mi web y mostrarlos graficamente, es decir, quiero mostrar en un grafico las visitas por dia del mes.

tambien me interesa tener un grafico por mes y por año..

pero me pierdo al traspasar los datos...necesito sus valiosos consejos..

que deberia hacer para ir traspazando al grafico los datos de la tabla, porque si los traspazo como se muestra, en la pantalla de resultado me muestra la última visita..deberia crear un array o algo que me vaya agregando los datos donde se hace la llamada al grafico.

uso el sgte tipo de grafico:
Código PHP:
<?php
include ("jpgraph/src/jpgraph.php");
include (
"jpgraph/src/jpgraph_bar.php");
$dias=$_GET["dias"];
$datay=array($dias);
// Create the graph. These two calls are always required
$graph = new Graph(300,200,"auto");    
$graph->SetScale("textlin");

// Add a drop shadow
$graph->SetShadow();

// Adjust the margin a bit to make more room for titles
$graph->img->SetMargin(40,30,20,40);

// Create a bar pot
$bplot = new BarPlot($datay);

// Adjust fill color
$bplot->SetFillColor('orange');

// Setup values
$bplot->value->Show();
$bplot->value->SetFormat('%d');
$bplot->value->SetFont(FF_FONT1,FS_BOLD);

// Center the values in the bar
$bplot->SetValuePos('center');

// Make the bar a little bit wider
$bplot->SetWidth(0.7);

$graph->Add($bplot);

// Setup the titles
$graph->title->Set("Centered values for bars");
$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);

// Display the graph
$graph->Stroke();
?>
su ayuda será bien recibida
__________________
Cristian...

Última edición por nav2003; 22/08/2006 a las 15:28