problema con grafico
Publicado por zendi (1058 intervenciones) el 25/11/2014 00:46:42
Tengo este codigo para crear un grafico con la libreria jpgraph.php, pero hay un problema que esta graficando solo tres barras si pudieran ayudarme por favor que no logro captar donde esta el error.
codigo:
imagen:

imagen de la tabla:

codigo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
include("jpgraph-3.5.0b1/inc/jpgraph.php");
include("jpgraph-3.5.0b1/inc/jpgraph_bar.php");
$connect = pg_connect("host=localhost port=5432 dbname=pediatria user=postgres password=099012");
$datos = "SELECT peso,talla,circunfcefalica,circunfbrazo,hepatitisa,hepatitisb,meses,anios FROM consulta";
$seleccionados = @pg_query($connect,$datos);
while($select4 = @pg_fetch_array($seleccionados)):
$hepatitisa[] = $select4['peso'];
$hepatitisb[] = $select4['talla'];
endwhile;
$graph = new Graph("500","400","auto");
$graph->SetScale("textint");
$graph->img->SetMargin(100,50,20,30);
$graph->title->Set("Titulo Grafico");
$graph->xaxis->title->Set("Altura");
$graph->yaxis->title->Set("Total");
$barplot = new BarPlot($hepatitisa);
$barplot->SetColor("Orange");
$barplot->Setwidth(30);
$graph->Add($barplot);
$graph->Stroke();
?>
imagen de la tabla:
Valora esta pregunta


0