[ Index ]
 

Code source de Cr@wltr@ck 2.2.1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/graphs/artichow/patterns/ -> BarDepth.php (source)

   1  <?php
   2  /*
   3   * This work is hereby released into the Public Domain.
   4   * To view a copy of the public domain dedication,
   5   * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
   6   * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
   7   *
   8   */
   9  
  10  require_once ARTICHOW."/BarPlot.class.php";
  11  
  12  class BarDepthPattern extends Pattern {
  13  
  14  	 function getPlot($y, $depth) {
  15          
  16          $plot = new BarPlot($y, 1, 1, $depth);
  17          
  18          $plot->barShadow->setSize(2);
  19          $plot->barShadow->smooth(TRUE);
  20          $plot->barShadow->setColor(new Color(160, 160, 160, 10));
  21          
  22          return $plot;
  23          
  24      }
  25  
  26  	 function create() {
  27  
  28          $group = new PlotGroup;
  29          $group->setSpace(2, 2, 2, 0);
  30          $group->setPadding(30, 10, NULL, NULL);
  31          
  32          $group->grid->hideVertical(TRUE);
  33          $group->grid->setType(LINE_DASHED);
  34          
  35          $yForeground = $this->getArg('yForeground');
  36          $yBackground = $this->getArg('yBackground');
  37          
  38          $legendForeground = $this->getArg('legendForeground');
  39          $legendBackground = $this->getArg('legendBackground');
  40          
  41          $colorForeground = $this->getArg('colorForeground', new LightBlue(10));
  42          $colorBackground = $this->getArg('colorBackground', new Orange(25));
  43          
  44          if($yForeground === NULL) {
  45              awImage::drawError("Class BarDepthPattern: Argument 'yForeground' must not be NULL.");
  46          }
  47          
  48          // Background
  49          if($yBackground !== NULL) {
  50              
  51              $plot = $this->getPlot($yBackground, 6);
  52              $plot->setBarColor($colorBackground);
  53              
  54              $group->add($plot);
  55              if($legendBackground !== NULL) {
  56                  $group->legend->add($plot, $legendBackground, LEGEND_BACKGROUND);
  57              }
  58              
  59          }
  60          
  61          // Foreground
  62          $plot = $this->getPlot($yForeground, 0);
  63          $plot->setBarColor($colorForeground);
  64          
  65          $group->add($plot);
  66          if($legendForeground !== NULL) {
  67              $group->legend->add($plot, $legendForeground, LEGEND_BACKGROUND);
  68          }
  69          
  70          $group->axis->bottom->hideTicks(TRUE);
  71          
  72          $group->legend->shadow->setSize(0);
  73          $group->legend->setAlign(LEGEND_CENTER);
  74          $group->legend->setSpace(6);
  75          $group->legend->setTextFont(new Tuffy(8));
  76          $group->legend->setPosition(0.50, 0.10);
  77          $group->legend->setBackgroundColor(new Color(255, 255, 255, 10));
  78          $group->legend->setColumns(2);
  79          
  80          return $group;
  81  
  82      }
  83  
  84  }
  85  ?>


Généré le : Thu Sep 6 14:14:11 2007 par Balluche grâce à PHPXref 0.7