Changeset 85


Ignore:
Timestamp:
06/01/07 02:27:19 (5 years ago)
Author:
nigel
Message:

Introduced X labels as defined by key values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • openweather/graph.php

    r84 r85  
    278278  //print "set $set<BR>"; 
    279279  //expand_pre($this->calculated['y_plot']); 
    280  
    281   foreach ($this->x_data as $index => $x) { 
    282      
     280  $index = -1; 
     281  foreach ($this->x_data as $x) { 
     282    $index++; 
    283283     
    284284    //print "index $index<BR>"; 
     
    722722 
    723723    // calculate y coords for plotting data 
    724     foreach ($this->x_data as $index => $x) { 
     724    $index = -1; 
     725    foreach ($this->x_data as $x) { 
     726      $index++; 
    725727      $this->calculated['y_plot'][$set][$index] = $this->y_data[$set][$index]; 
    726728 
     
    10601062      $data = $this->x_data; 
    10611063      for ($i=0; $i < $this->calculated['x_axis']['num_ticks']; $i++) { 
     1064        $key = key($data); 
    10621065        $value = array_shift($data); // grab value from begin of array 
     1066        if (is_numeric($key)) $key = $value; 
    10631067        $this->calculated['x_axis']['data'][$i]  = $value; 
    1064         $this->calculated['x_axis']['text'][$i]  = $value; // raw data and text are both the same in this case 
     1068        $this->calculated['x_axis']['text'][$i]  = $key; // raw data and text are both the same in this case 
    10651069        $size = $this->get_boundaryBox( 
    10661070          array('points' => $axis_size, 
     
    10681072                'angle'  => $axis_angle, 
    10691073                'colour' => $axis_colour, 
    1070                 'text'   => $value)); 
     1074                'text'   => $key)); 
    10711075        $this->calculated['x_axis']['boundary_box'][$i] = $size; 
    10721076        if ($size['height'] > $this->calculated['x_axis']['boundary_box_max']['height']) 
Note: See TracChangeset for help on using the changeset viewer.