linea21-externals
[ class tree: linea21-externals ] [ index: linea21-externals ] [ all elements ]

Source for file BarDepth.php

Documentation is available at BarDepth.php

  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. /**
  11.  * @package linea21.externals
  12.  * @subpackage artichow
  13.  */
  14.  
  15. require_once ARTICHOW."/BarPlot.class.php";
  16.  
  17. class BarDepthPattern extends Pattern {
  18.  
  19.   function getPlot($y, $depth) {
  20.  
  21.     $plot = new BarPlot($y, 1, 1, $depth);
  22.  
  23.     $plot->barShadow->setSize(2);
  24.     $plot->barShadow->smooth(TRUE);
  25.     $plot->barShadow->setColor(new Color(160, 160, 160, 10));
  26.  
  27.     return $plot;
  28.  
  29.   }
  30.  
  31.   function create() {
  32.  
  33.     $group = new PlotGroup;
  34.     $group->setSpace(2, 2, 2, 0);
  35.     $group->setPadding(30, 10, NULL, NULL);
  36.  
  37.     $group->grid->hideVertical(TRUE);
  38.     $group->grid->setType(LINE_DASHED);
  39.  
  40.     $yForeground = $this->getArg('yForeground');
  41.     $yBackground = $this->getArg('yBackground');
  42.  
  43.     $legendForeground = $this->getArg('legendForeground');
  44.     $legendBackground = $this->getArg('legendBackground');
  45.  
  46.     $colorForeground = $this->getArg('colorForeground', new LightBlue(10));
  47.     $colorBackground = $this->getArg('colorBackground', new Orange(25));
  48.  
  49.     if($yForeground === NULL) {
  50.       awImage::drawError("Class BarDepthPattern: Argument 'yForeground' must not be NULL.");
  51.     }
  52.  
  53.     // Background
  54.     if($yBackground !== NULL) {
  55.           
  56.       $plot = $this->getPlot($yBackground, 6);
  57.       $plot->setBarColor($colorBackground);
  58.           
  59.       $group->add($plot);
  60.       if($legendBackground !== NULL) {
  61.         $group->legend->add($plot, $legendBackground, LEGEND_BACKGROUND);
  62.       }
  63.           
  64.     }
  65.  
  66.     // Foreground
  67.     $plot = $this->getPlot($yForeground, 0);
  68.     $plot->setBarColor($colorForeground);
  69.  
  70.     $group->add($plot);
  71.     if($legendForeground !== NULL) {
  72.       $group->legend->add($plot, $legendForeground, LEGEND_BACKGROUND);
  73.     }
  74.  
  75.     $group->axis->bottom->hideTicks(TRUE);
  76.  
  77.     $group->legend->shadow->setSize(0);
  78.     $group->legend->setAlign(LEGEND_CENTER);
  79.     $group->legend->setSpace(6);
  80.     $group->legend->setTextFont(new Tuffy(8));
  81.     $group->legend->setPosition(0.50, 0.10);
  82.     $group->legend->setBackgroundColor(new Color(255, 255, 255, 10));
  83.     $group->legend->setColumns(2);
  84.  
  85.     return $group;
  86.  
  87.   }
  88.  
  89. }
  90. ?>

Documentation generated on Thu, 03 May 2012 15:02:07 +0200 by phpDocumentor 1.4.1