Changeset 86


Ignore:
Timestamp:
06/01/07 03:24:09 (5 years ago)
Author:
nigel
Message:

Plotting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • openweather/openweather.module

    r84 r86  
    177177 
    178178  //$output .= openweather_graph($res); 
     179  $output .= "<img src='?q=node/".$node->nid."/graph' />"; 
    179180 
    180181  $node->links = $links; 
     
    340341  $node = node_load($nid); 
    341342 
    342   if ($type == null) $type = 'temp'; 
    343  
    344   $results = openweather_get_values($node); 
     343  if ($type == null) $type = 'temp_in'; 
     344 
     345  $r = db_query("SELECT `time`, $type FROM {openweather_readings} WHERE nid = $nid AND `time` >= ".(time() - (60*60*24)) . " ORDER BY `time`" ); 
     346 
     347  #$results = openweather_get_values($node); 
    345348  drupal_set_header('Content-Type: image/png'); 
    346349  include 'graph.php'; 
     
    351354  $g->parameter['y_label'] = ''; 
    352355 
     356  $g->x_data = array(); 
     357  $g->y_data = array( $type=>array() ); 
     358  while ($e = db_fetch_array($r)) { 
     359    $g->x_data = array_merge($g->x_data, array($e[0]=>$e[0])); 
     360    $g->y_data[$type][] = $e[1]; 
     361  } 
    353362  $g->draw(); 
    354363} 
Note: See TracChangeset for help on using the changeset viewer.