Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/07/2005, 23:55
aj22
 
Fecha de Ingreso: julio-2005
Mensajes: 1
Antigüedad: 18 años, 8 meses
Puntos: 0
ayuda para elaborar un grafico jpgraph en PHP

Hola, necesito ayuda para elaborar un grafico jpgraph en PHP con datos extraidos de una consulta de MYSQL, soy nuevo con el PHP y agradeciria mucho su ayuda, el codigo que empleo es el siguiente pero me da un error:

<?
//Conexion con la base
include('config.php');
//Ejecutamos la sentencia SQL
$result=mysql_db_query("$db","select count(voto) as num from encuesta group by voto");
?>
<?
while ($row=mysql_fetch_array($result))
{


}

//mysql_free_result($result)
?>

<?php

include ("src/jpgraph.php");
include ("src/jpgraph_bar.php");

// We need some data
//$datay=array(4,8,6);
$datay[0]=mysql_result($result,0);
$datay[1]=mysql_result($result,1);
$datay[2]=mysql_result($result,2);
$datay[3]=mysql_result($result,3);
// Setup the graph.
$graph = new Graph(200,150,"auto");
$graph->SetScale("textlin");
$graph->img->SetMargin(25,15,25,25);

$graph->title->Set('"GRAD_MIDVER"');
$graph->title->SetColor('darkred');

// Setup font for axis
$graph->xaxis->SetFont(FF_FONT1);
$graph->yaxis->SetFont(FF_FONT1);

// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.6);

// Setup color for gradient fill style
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_MIDV ER);

// Set color for the frame of each bar
$bplot->SetColor("navy");
$graph->Add($bplot);

// Finally send the graph to the browser
$graph->Stroke();
?>