triby gracias por responder , ya logro graficar
pero tengo un problema con el ejex donde estan las fechas , me divide en 24 fechas y la consulta solo tiene 5 registros
campo10 fechas1
real doble precision
10 1340773983
8 1340773246
5 1340773654
30 1340774539
25 1340774119
este es el codigo que utilizo
Código PHP:
Ver originalinclude('inc/jpgraph.php');
include('inc/jpgraph_line.php');
include('inc/jpgraph_date.php');
include('inc/jpgraph_utils.inc.php');
$dateUtils = new DateScaleUtils();
$width=700; $height=400;
$graph = new Graph($width, $height);
$graph->SetScale('datlin');
$graph->SetMargin(60,20,40,60);
$graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
$graph->title->Set('Development since 1984');
$graph->subtitle->SetFont(FF_ARIAL,FS_ITALIC,10);
$graph->subtitle->Set('(Example using the builtin date scale)');
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
$graph->xaxis->SetLabelAngle(30);
$servidor = 'localhost';
$bd = 'tremor';
$usuario = 'postgres';
$contrasenia = '*****';
$tabla = 'tremor';
global $servidor, $bd, $usuario, $contrasenia;
$db = new PDO('pgsql:host=' . $servidor . ';dbname=' . $bd, $usuario, $contrasenia);
$consulta = $db->prepare("SELECT campo10, campo1, EXTRACT(epoch FROM campo1)AS fechas1 FROM tremor;");
$consulta->execute();
while($fila = $consulta->fetch(PDO::FETCH_ASSOC))
{
$ydata[] = $fila['campo10'];
$xdata[] = $fila['fechas1'];
}
//var_dump($xdata, $ydata);
$lp1 = new LinePlot($ydata,$xdata);
$lp1->SetWeight(0);
$graph->Add($lp1);
$lp2 = new LinePlot($ydata,$xdata);
$lp2->SetColor('orange');
$graph->Add($lp2);
$graph->Stroke();
que estoy haciendo mal?
quiero mostrarle las imagenes pero no se como subirlas no tengo pagina para subirla.