Foros del Web » Programando para Internet » PHP »

inconvenientes para crear imagen con jpgraph y postgresql

Estas en el tema de inconvenientes para crear imagen con jpgraph y postgresql en el foro de PHP en Foros del Web. Hola amigos espero me puedan ayudar, me encuentro generando una grafica con jpgraph y postgresql pero me sale el siguiente error Chosen locale file ("lang/en.inc.php") ...
  #1 (permalink)  
Antiguo 16/07/2012, 00:21
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
inconvenientes para crear imagen con jpgraph y postgresql

Hola amigos espero me puedan ayudar, me encuentro generando una grafica con jpgraph y postgresql pero me sale el siguiente error


Chosen locale file ("lang/en.inc.php") for error messages does not exist or is not readable for the PHP process. Please make sure that the file exists and that the file permissions are such that the PHP process is allowed to read this file.


este es mi codigo


Código PHP:
Ver original
  1. <?php // content="text/plain; charset=utf-8"
  2. require_once('jpgraph/jpgraph.php');
  3. require_once('jpgraph/jpgraph_bar.php');
  4.  
  5. //$datay1=array(13,8,19,7,17,6);
  6. //$datay2=array(4,5,2,7,5,25);
  7.  
  8.  
  9.         $servidor = 'localhost';
  10.         $bd = 'indumontes';
  11.         $usuario = 'postgres';
  12.         $contrasenia = 'hoe798cs';
  13.         $tabla = 'factura';
  14.        
  15.  
  16.         global $servidor, $bd, $usuario, $contrasenia;
  17.         $db = new PDO('pgsql:host=' . $servidor . ';dbname=' . $bd, $usuario, $contrasenia);
  18.  
  19.         $consulta = $db->prepare("SELECT vendedor,total FROM $tabla");
  20.         $consulta->execute();
  21.  
  22.         while($fila = $consulta->fetch(PDO::FETCH_ASSOC))
  23.         {
  24.         $datay1[] = $fila[0];
  25.         $datay2[] = $fila[1];
  26.         }
  27.  
  28.  
  29.  
  30.  
  31. // Create the graph.
  32. $graph = new Graph(550,300);
  33. $graph->SetScale('textlin');
  34. $graph->SetMarginColor('white');
  35.  
  36. // Setup title
  37. $graph->title->Set('Acc bar with gradient');
  38.  
  39. // Create the first bar
  40. $bplot = new BarPlot($datay1);
  41. $bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT);
  42. $bplot->SetColor('darkred');
  43.  
  44. // Create the second bar
  45. $bplot2 = new BarPlot($datay2);
  46. $bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT);
  47. $bplot2->SetColor('darkgreen');
  48.  
  49. // And join them in an accumulated bar
  50. $accbplot = new AccBarPlot(array($bplot,$bplot2));
  51. $graph->Add($accbplot);
  52.  
  53. $graph->Stroke();
  54.  
  55.  
  56.  
  57. ?>


que estoy haciendo mal?
  #2 (permalink)  
Antiguo 16/07/2012, 03:06
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: inconvenientes para crear imagen con jpgraph y postgresql

ya no me aparece el mensaje "Chosen locale file ("lang/en.inc.php") for e........"

se debia a que no tenia en jpgraph la carpeta lan

pero ahora me aparece el siguiente errror

"JpGraph Error:2014

Number of datapoints for each data set in accbarplot must be the same"

alguien tiene idea porque ?
  #3 (permalink)  
Antiguo 16/07/2012, 03:31
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: inconvenientes para crear imagen con jpgraph y postgresql

estoy realizando prueba y veo algo raro


Código PHP:
Ver original
  1. while($fila = $consulta->fetch(PDO::FETCH_ASSOC))
  2.         {
  3.             $datay1[] = $fila[0];
  4.                 $datay2[] = $fila[1];
  5.         print_r( $datay1);
  6.                 exit;
  7.         }



Array ( [0] => )




y lo pruebo de la siguiente manera para saber si la consulta esta bien y no hay nigun problema , la consulta se ejecuta satisfactoriamente.



Código PHP:
Ver original
  1. $servidor = 'localhost';
  2.         $bd = 'indumontes';
  3.         $usuario = 'postgres';
  4.         $contrasenia = 'hoe798cs';
  5.         $tabla = 'factura';
  6.        
  7.  
  8.         global $servidor, $bd, $usuario, $contrasenia;
  9.         $db = new PDO('pgsql:host=' . $servidor . ';dbname=' . $bd, $usuario, $contrasenia);
  10.  
  11.         $consulta = $db->prepare("SELECT vendedor,SUM (total) FROM $tabla GROUP BY vendedor");
  12.         $consulta->execute();
  13.  
  14.         while($fila = $consulta->fetch(PDO::FETCH_ASSOC))
  15.         {
  16.        // $datay1[] = $fila[0];
  17.        // $datay2[] = $fila[1];
  18.         echo $vendedor = $fila['vendedor'];
  19.         echo $total=$fila['sum'];
  20.         }

Última edición por Montes28; 16/07/2012 a las 03:37

Etiquetas: inconvenientes, jpgraph, postgresql, sql, tabla, usuarios
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:52.