Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/03/2014, 20:02
Avatar de elmoikano
elmoikano
 
Fecha de Ingreso: enero-2013
Mensajes: 50
Antigüedad: 11 años, 4 meses
Puntos: 0
Pregunta Grafica de puntos con PHPLOT

Hola amigos el foro, pues nada que ahora ando con este problema, estoy iniciandome con graficas y hasta ahora al que mas he entendido la estructura es PHPLOT, y trato de hacer una grafica segun yo muy sencilla que me indique un porcentaje mensual.

la consulta ya la tengo y si funciona es la siguiente:
Código:
mysql> select YEAR(fecha) AS AÑO, MONTH(fecha) AS MES, MONTHNAME(fecha) AS NOMBRE, COUNT(fecha) AS pormes,ROUND(AVG(profun+orden+claridad+mat_didactico+ac_dudas+m_tiempo)/6*100/5,2) as desempeñomensual from dbencuestas GROUP BY AÑO DESC, MES ASC;
+------+------+----------+--------+-------------------+
| AÑO  | MES  | NOMBRE   | pormes | desempeñomensual  |
+------+------+----------+--------+-------------------+
| 2014 |    1 | January  |     20 |             70.00 |
| 2014 |    2 | February |     22 |             60.00 |
| 2014 |    3 | March    |     61 |             55.25 |
+------+------+----------+--------+-------------------+
3 rows in set (0.00 sec)
y ahora trato de graficarla con el siguiente código de PHPLOT:
Código PHP:
<?php
//Include the code
require_once 'Connection.simple.php';
    
$result "";
    
$row null;
    
$conn dbConnect();
require_once 
'phplot-6.1.0/phplot.php';
//create a PHPlot object with 800x600 pixel image
$plot = new PHPlot(800,600);
//Define some data
//select YEAR(fecha) AS AÑO, MONTH(fecha) AS MES, MONTHNAME(fecha) AS NOMBRE, COUNT(fecha) AS desempeñomes,ROUND(AVG(profun+orden+claridad+mat_didactico+ac_dudas+m_tiempo)/6,2) as AVGgral,ROUND(AVG(profun+orden+claridad+mat_didactico+ac_dudas+m_tiempo)/6*100/5,2) as desempeñomensual from dbencuestas GROUP BY AÑO DESC, MES DESC
$sql ="select ROUND(AVG(profun+orden+claridad+mat_didactico+ac_dudas+m_tiempo)/6*100/5,2) as desempeñomensual from dbencuestas GROUP BY AÑO DESC, MES ASC";
$get mysql_fetch_array($sql,$conn);

while(
$row=mysql_fetch_array($get,$conn)){
    
$monthdese="{$row['desempeñomensual']}";
$data = array(
 array(
'ENERO',$monthdese),
 array(
'FEBRERO',$monthdese),
 array(
'MARZO',$monthdese),
 array(
'ABRIL',$monthdese),
 array(
'MAYO',$monthdese),
 array(
'JUNIO',$monthdese),
 array(
'JULIO',$monthdese),
 array(
'AGOSTO',$monthdese),
array(
'SEPTIEMBRE',$monthdese),
array(
'OCTUBRE',$monthdese),
array(
'NOVIEMBRE',$monthdese),
array(
'DICIEMBRE',$monthdese)
);}
$plot->SetDataValues($data);
//Set titles
$plot->SetTitle("EVALUACION GLOBAL 2014");
$plot->SetXTitle('MES');
$plot->SetYTitle('% DE SATISFACCION');
//Turn off X axis ticks and labels because they get in the way:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
//Draw it
$plot->DrawGraph();
Y lo unico que me envía es DrawGraph: No data Array;

ayuda por favor!!!!
__________________
Bibliotecario pero morboso de las Tecnologías....

Última edición por elmoikano; 21/03/2014 a las 20:10