Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/07/2013, 22:55
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 6 meses
Puntos: 6
Problema para graficar serie de tiempo con Highcharts js

Hola espero me puedan ayudar , estoy utilizando Highcharts js y necesito graficar una serie de tiempo de una consulta a una base de datos , son aproximadamente 1000 datos y cada dato es de cada minuto

tengo un archivo php con el cual consulto la base y obtengo los registros data.php
Código PHP:
Ver original
  1. $usuario = '******';
  2. $contrasenia = '****';
  3.    
  4.             try {
  5.                 $db = new PDO('pgsql:host=localhost;dbname=****',$usuario,$contrasenia);
  6.                 //$db = new PDO('pgsql:host=192.168.102.200;dbname=volcanoes',$usuario,$contrasenia);
  7.                 }catch(PDOException $e) {
  8.                 //echo $e->getMessage();
  9.                 echo "Usuario y Clave Invalidas";
  10.                 throw new Exception("Usuario y Clave Invalidas", 0, $e);
  11.                 }
  12.                
  13.                
  14. $consulta = $db->prepare("SELECT * FROM anemometro");              
  15. $consulta->execute();    
  16.  
  17.  
  18. while($fila = $consulta->fetch(PDO::FETCH_ASSOC))
  19.     {
  20.     echo $fila['fecha'].$fila['hora']. "\t" . $fila['temperatura']. "\n";  
  21.             }

esta ahi todo va bien , el proble inicia para graficar la serie de tiempo , hasta el momento este es mi codigo index.php
Código PHP:
Ver original
  1. $(function () {
  2.         $('#container').highcharts({
  3.             chart: {
  4.                 zoomType: 'x',
  5.                 spacingRight: 20
  6.             },
  7.             title: {
  8.                 text: 'Metereologica'
  9.             },
  10. xAxis: {
  11.                 type: 'datetime',
  12.                 maxZoom: 14 * 24 * 3600000, // fourteen days
  13.                 title: {
  14.                     text: null
  15.                 }
  16.             },
  17.             yAxis: {
  18.                 title: {
  19.                     text: 'Temperatura'
  20.                 }
  21.             },
  22.                         plotOptions: {
  23.                 area: {
  24.                     fillColor: {
  25.                         linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1},
  26.                         stops: [
  27.                             [0, Highcharts.getOptions().colors[0]],
  28.                             [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
  29.                         ]
  30.                     },
  31.                     lineWidth: 1,
  32.                     marker: {
  33.                         enabled: false
  34.                     },
  35.                     shadow: false,
  36.                     states: {
  37.                         hover: {
  38.                             lineWidth: 1
  39.                         }
  40.                     },
  41.                     threshold: null
  42.                 }
  43.             },
  44.    
  45.  
  46.  
  47. /* como obtengo el archivo php para graficar los datos*/
  48.             series: [{
  49.                 type: 'area',
  50.                
  51.                 pointInterval: 24 * 3600 * 1000,
  52.                 pointStart: Date.UTC(2006, 0, 01),
  53.                 data: [ ]
  54.             }]
  55.         });
  56.     });