TeeChartPHP
[ class tree: TeeChartPHP ] [ index: TeeChartPHP ] [ all elements ]

Source for file Bar3D.php

Documentation is available at Bar3D.php

  1. <?php
  2.  
  3. /**
  4.   *
  5.   * <p>Title: Bar3D class</p>
  6.   *
  7.   * <p>Description: Bar3D series.</p>
  8.   *
  9.   * <p>Example:
  10.   * <pre><font face="Courier" size="4">
  11.   * series1 = new Bar3D(myChart.getChart());
  12.   * series1.add( 0, 250, 200, "A", Color.RED );
  13.   * series1.add( 1,  10, 200, "B", Color.GREEN );
  14.   * series1.add( 2,  90, 100, "C", Color.YELLOW );
  15.   * series1.add( 3,  30,  50, "D", Color.BLUE );
  16.   * series1.add( 4,  70, 150, "E", Color.WHITE );
  17.   * series1.add( 5, 120, 150, "F", Color.SILVER );
  18.   * series1.setColorEach(true);
  19.   * series1.getMarks().setArrowLength(20);
  20.   * series1.getMarks().setVisible(true);
  21.   * series1.setBarStyle(BarStyle.RECTGRADIENT);
  22.   * series1.setBarWidthPercent(90);
  23.   * series1.getGradient().setDirection(GradientDirection.HORIZONTAL);
  24.   * series1.getGradient().setStartColor(Color.YELLOW);
  25.   * </font></pre></p>
  26.   *
  27.   * <p>Copyright (c) 2005-2007 by Steema Software SL. All Rights
  28.   * Reserved.</p>
  29.   *
  30.   * <p>Company: Steema Software SL</p>
  31.   *
  32.   */
  33.  
  34.  class Bar3D extends Bar {
  35.  
  36.     private $offsetValues;
  37.  
  38.     public function Bar3D($c=null{
  39.         parent::Bar($c);
  40.  
  41.         $this->offsetValues new ValueList($this"ValuesOffset");
  42.                                                 /* TODO $this->Language->getString("ValuesOffset")*/
  43.     }
  44.  
  45.     protected function addSampleValues($numValues{
  46.         $r $this->randomBounds($numValues);
  47.  
  48.         for ($t 1$t <= $numValues$t++{
  49.             $r->tmpY $r->DifY $r->Random();
  50.             $this->addBar($r->tmpX10 abs($r->tmpY),
  51.                    abs($r->DifY ($r->Random())));
  52.             $r->tmpX += $r->StepX;
  53.         }
  54.     }
  55.  
  56.     /**
  57.     * Adds a bar with an X and Y value, Y start point and color.
  58.     *
  59.     * @param double $x 
  60.     * @param double $y 
  61.     * @param double $offset 
  62.     * @param Color $color 
  63.     * @return int 
  64.     */
  65. /*    public function add($x, $y, $offset, $color) {
  66.         return $this->add($x, $y, $offset, "", $color);
  67.     }
  68. */
  69.         /**
  70.           * Adds a bar with an X and Y value and Y start point.
  71.           *
  72.           * @param double
  73.           * @param double
  74.           * @param offset double
  75.           * @return int 
  76.           */
  77. /*    public function add($x, $y, $offset) {
  78.         $tmpColor = new Color();
  79.         return $this->add($x, $y, $offset, "", $tmpColor->EMPTY);
  80.     }
  81. */
  82.         /**
  83.           * Adds a bar with an X and Y value with offset and label.
  84.           *
  85.           * @param double
  86.           * @param double
  87.           * @param offset double
  88.           * @param text String
  89.           * @return int 
  90.           */
  91. /*    public function add($x, $y, $offset, $text) {
  92.         $tmpColor = new Color();
  93.         return $this->add($x, $y, $offset, $text, $tmpColor->EMPTY);
  94.     }
  95. */
  96.     /**
  97.     * Adds a bar with an X and Y value, Y start point, label and color.
  98.     *
  99.     * @param double $x 
  100.     * @param double $y 
  101.     * @param double $offset 
  102.     * @param String $text 
  103.     * @param Color $color 
  104.     * @return int 
  105.     */
  106.     public function addBar($x$y$offset$text=""$color=null{
  107.         if ($color==null)
  108.            $color new Color(0,0,0,127,true);  // EMPTY
  109.  
  110.         $this->offsetValues->tempValue $offset;
  111.         return $this->addXYTextColor($x$y$text$color);
  112.     }
  113.  
  114.     public function getOriginValue($valueIndex{
  115.         return parent::getOriginValue($valueIndex$this->offsetValues->value[$valueIndex];
  116.     }
  117.  
  118.     /**
  119.     * Returns the Maximum Value of the Series Y Values List.
  120.     *
  121.     * @return double 
  122.     */
  123.     public function getMaxYValue({
  124.         $result parent::getMaxYValue();
  125.         if (($this->iMultiBar == MultiBars::$NONE|| ($this->iMultiBar == MultiBars::$SIDE)) {
  126.             $result max($result$this->offsetValues->getMaximum());
  127.         }
  128.         return $result;
  129.     }
  130.  
  131.     /**
  132.     * Returns the Minimum Value of the Series Y Values List.
  133.     *
  134.     * @return double 
  135.     */
  136.     public function getMinYValue({
  137.         $result parent::getMinYValue();
  138.         if (($this->iMultiBar == MultiBars::$NONE|| ($this->iMultiBar == MultiBars::$SIDE)) {
  139.             for ($t 0$t $this->getCount()$t++{
  140.                 if ($this->offsetValues->value[$t0{
  141.                     $result min($result$this->vyValues->value[$t$this->offsetValues->value[$t]);
  142.                 }
  143.             }
  144.         }
  145.         return $result;
  146.     }
  147.  
  148.     /**
  149.     * Returns the corresponding screen pixels coordinate of the leftmost
  150.     * horizontal bar edge.
  151.     * The UseOrigin property must be true (the default) to use the Origin
  152.     * method.
  153.     * Bars with a value bigger than Origin are drawn in one direction and
  154.     * Bars with a lower value are drawn in the opposite direction.
  155.     * This applies both to Bar series and HorizBar series classes.
  156.     * Default Value: 0
  157.     *
  158.     * @param int $valueIndex 
  159.     * @param boolean $sumAll 
  160.     * @return double 
  161.     */
  162.     public function pointOrigin($valueIndex$sumAll{
  163.         return $this->offsetValues->value[$valueIndex];
  164.     }
  165.  
  166.     /**
  167.     * Specifies a different origin value for each bar point.
  168.     * This can be used with standard Bar series components to make a
  169.     * "Stacked-3D" chart type.
  170.     *
  171.     * @return ValueList 
  172.     */
  173.     public function getOffsetValues({
  174.         return $this->offsetValues;
  175.     }
  176.  
  177.     /**
  178.     * Specifies a different origin value for each bar point.
  179.     * This can be used with standard Bar series components to make a
  180.     * "Stacked-3D" chart type.
  181.     *
  182.     * @param ValueList $value 
  183.     */
  184.     public function setOffsetValues($value{
  185.         $this->setValueList($this->offsetValues$value);
  186.     }
  187.  
  188.     /**
  189.     * Gets descriptive text.
  190.     *
  191.     * @return String 
  192.     */
  193.     public function getDescription({
  194.         return Language::getString("GalleryBar3D");
  195.     }
  196.  
  197.     protected function subGalleryStack({
  198.         return false// 5.01      at sub-gallery
  199.     }
  200. }
  201.  
  202. ?>

Documentation generated on Wed, 16 Jun 2010 12:03:23 +0200 by phpDocumentor 1.4.1