Source for file Grid.class.php
Documentation is available at Grid.class.php 
 * This work is hereby released into the Public Domain.  
 * To view a copy of the public domain dedication,  
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to  
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.  
require_once dirname(__FILE__ ). "/../Graph.class.php";  
 * @package linea21.externals  
   * Vertical lines of the grid  
  private $xgrid =  array();  
   * Horizontal lines of the grid  
  private $ygrid =  array();  
   * Is the component grid hidden ?  
   * Are horizontal lines hidden ?  
  private $hideHorizontal =  FALSE;  
   * Are vertical lines hidden ?  
  private $hideVertical =  FALSE;  
  private $type =  awLine::SOLID;  
  private $interval =  array(1, 1);  
    // Set a grid default color  
    $this->color =  new awColor(210, 210, 210);  
    $this->background =  new awColor(255, 255, 255, 100);  
  public function hide($hide =  TRUE) {  
    $this->hide = (bool) $hide;  
   * Hide horizontal lines ?  
   * @param bool $hideHorizontal   
    $this->hideHorizontal = (bool) $hide;  
   * @param bool $hideVertical   
    $this->hideVertical = (bool) $hide;  
  public function setColor(awColor $color) {  
    $this->background =  NULL;  
   * Change grid background color  
    $this->background =  $color;  
    $this->type = (int) $type;  
    $this->interval =  array((int) $hInterval, (int) $vInterval);  
   * @param int $left Left space in pixels  
   * @param int $right Right space in pixels  
   * @param int $top Top space in pixels  
   * @param int $bottom Bottom space in pixels  
  public function setSpace($left, $right, $top, $bottom) {  
    $this->space =  array((int) $left, (int) $right, (int) $top, (int) $bottom);  
   * Change the current grid  
   * @param array $xgrid Vertical lines  
   * @param array $ygrid Horizontal lines  
  public function setGrid($xgrid, $ygrid) {  
    if(empty($this->xgrid)) {  
    if(empty($this->ygrid)) {  
   * @param awDriver $driver A driver object  
  public function draw(awDriver $driver, $x1, $y1, $x2, $y2) {  
    if($this->background instanceof  awColor) {  
      $driver->filledRectangle(  
    if($this->hide ===  FALSE) {  
      $this->hideVertical ?  array() :  $this->xgrid,  
      $this->hideHorizontal ?  array() :  $this->ygrid,  
  private function drawGrid(  
  awDriver $driver, awColor $color,  
  $nx, $ny, $x1, $y1, $x2, $y2,  
  $type, $space, $hInterval, $vInterval  
    list ($left, $right, $top, $bottom) =  $space; 
    $width =  $x2 -  $x1 -  $left -  $right;  
    $height =  $y2 -  $y1 -  $top -  $bottom;  
    foreach($nx as $key =>  $n) {  
      if(($key %  $vInterval) ===  0) {  
        $pos = (int) round($x1 +  $left +  $n *  $width);  
    foreach($ny as $key =>  $n) {  
      if(($key %  $hInterval) ===  0) {  
        $pos = (int) round($y1 +  $top +  $n *  $height);  
 
 
        
       |