|
From: Ariel G. <ag...@us...> - 2001-12-06 19:39:14
|
Update of /cvsroot/vagrant/vagrant-2.5
In directory usw-pr-cvs1:/tmp/cvs-serv2529
Modified Files:
Graph.class
Log Message:
this should fix y-axis and axis2 tick issues
Index: Graph.class
===================================================================
RCS file: /cvsroot/vagrant/vagrant-2.5/Graph.class,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Graph.class 2001/12/06 02:32:58 1.9
--- Graph.class 2001/12/06 19:39:10 1.10
***************
*** 86,96 ****
} // else we are not using y labels
! if (!$this->IsUserValue('y_tick') || ($this->GetValue('y_data_diff') / $this->GetValue('y_tick') > ($this->height / $this->text_size['height']))) {
! $this->SetValue('num_y_grid', ceil(min($this->GetValue('num_y_grid'), $this->height / $this->text_size['height'])), true);
$this->SetValue('y_tick', $this->GetTick($this->GetValue('y_data_diff'), $this->GetValue('num_y_grid'), $integer));
} // if a value for y_tick was defined
if (!$this->IsUserValue('num_y_grid')) {
! $this->SetValue('num_y_grid', floor($this->GetValue('y_data_diff') / $this->GetValue('y_tick')));
} // else if the number of grid lines is not specified
--- 86,100 ----
} // else we are not using y labels
! if (!$this->IsUserValue('y_tick')) {
$this->SetValue('y_tick', $this->GetTick($this->GetValue('y_data_diff'), $this->GetValue('num_y_grid'), $integer));
} // if a value for y_tick was defined
+ if ($this->GetValue('y_data_diff') / $this->GetValue('y_tick') > ($this->height / $this->text_size['height'])) {
+ $this->SetValue('num_y_grid', ceil($this->height / $this->text_size['height']), true);
+ $this->SetValue('y_max', $this->GetValue('y_min') + $this->GetValue('y_tick') * $this->GetValue('num_y_grid'));
+ } // if there are too many grid lines
+
if (!$this->IsUserValue('num_y_grid')) {
! $this->SetValue('num_y_grid', ceil($this->GetValue('y_data_diff') / $this->GetValue('y_tick')));
} // else if the number of grid lines is not specified
***************
*** 146,175 ****
// Get the actual number of y grid lines
//
! $axis2_max_mod = $this->GetValue('y_data_diff') / $this->GetValue('y_tick');
! $num_y_grid = floor($axis2_max_mod);
!
! // Set the modifier that will adjust the axis2 max in case the top grid line doesn't correspond to y max
! //
! $axis2_max_mod = $axis2_max_mod / $num_y_grid;
!
$axis2_data = true;
! $new_axis2_min = $this->AdjustNum($this->GetValue('axis2_min'), $this->GetValue('axis2_data_diff'), ROUND_DOWN);
if ($this->IsUserValue('axis2_tick')) {
! $axis2_mod = ceil(($this->GetValue('axis2_max') - $new_axis2_min) / ($this->GetValue('axis2_tick') * ($this->GetValue('num_y_grid') - 1)));
! $this->SetValue('axis2_tick', $this->GetValue('axis2_tick') * $axis2_mod);
! $new_axis2_max = $new_axis2_min + $this->GetValue('axis2_tick') * ($this->GetValue('num_y_grid'));
} // if the user has modified the axis2 tick
else {
! $new_axis2_max = $this->AdjustNum($this->GetValue('axis2_max'), $this->GetValue('axis2_data_diff'), ROUND_UP);
! $axis2_tick = $this->GetTick($new_axis2_max - $new_axis2_min, $this->GetValue('num_y_grid') - 1, $integer);
! $new_axis2_max = $new_axis2_min + $axis2_tick * $this->GetValue('num_y_grid');
$this->SetValue('axis2_tick', $axis2_tick);
} // else we are creating our own tick
! $axis2_tick = $new_axis2_min; // this will be used for the axis labels on the right side of the grid
! $this->SetValue('axis2_min', $new_axis2_min);
! $this->SetValue('axis2_max', $new_axis2_max * $axis2_max_mod);
} // if we have axis2 data
else {
--- 150,170 ----
// Get the actual number of y grid lines
//
! $num_y_grid = $this->GetValue('y_data_diff') / $this->GetValue('y_tick');
$axis2_data = true;
!
! $this->SetValue('axis2_min', $this->AdjustNum($this->GetValue('axis2_min'), $this->GetValue('axis2_data_diff'), ROUND_DOWN));
if ($this->IsUserValue('axis2_tick')) {
! $new_axis2_max = $this->GetValue('axis2_min') + $this->GetValue('axis2_tick') * $num_y_grid;
} // if the user has modified the axis2 tick
else {
! $axis2_tick = $this->GetTick($this->GetValue('axis2_data_diff'), $num_y_grid, $integer);
! $new_axis2_max = $axis2_tick * $num_y_grid + $this->GetValue('axis2_min');
$this->SetValue('axis2_tick', $axis2_tick);
} // else we are creating our own tick
! $axis2_tick = $this->GetValue('axis2_min');
! $this->SetValue('axis2_max', $new_axis2_max);
} // if we have axis2 data
else {
|