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

Source for file SeriesMarks.php

Documentation is available at SeriesMarks.php

  1. <?php
  2.  
  3. /**
  4.  * SeriesMarks class
  5.  *
  6.  * Description: Series Marks characteristics
  7.  *
  8.  * @author
  9.  * @copyright Copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @subpackage styles
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16. class SeriesMarks extends TextShape
  17. {
  18.    /**
  19.    * When True, Marks arrow pen color is changed if the
  20.    * point has the same color.
  21.    */
  22.  
  23.    public $checkMarkArrowColor = true;
  24.  
  25.    protected $iSeries;
  26.    protected $pPositions;
  27.    protected $bClip=false;
  28.    protected $markerStyle = 2// MarksStyle::$LABEL
  29.  
  30.    private $multiLine=false;
  31.    private $drawEvery 1;
  32.    private $zPosition = -1;
  33.    private $angle=0;
  34.    private $callout=null;
  35.    private $items=null;
  36.    private $symbol=null;
  37.    private $textAlign;
  38.  
  39.    // Interceptors
  40.    function __get$property {
  41.      $method ="get{$property}";
  42.      if method_exists$this$method ) ) {
  43.        return $this->$method();
  44.      }
  45.    }
  46.  
  47.    function __set $property,$value {
  48.      $method ="set{$property}";
  49.      if method_exists$this$method ) ) {
  50.        return $this->$method($value);
  51.      }
  52.    }
  53.  
  54.    /**
  55.    * The class constructor.
  56.    */
  57.    public function SeriesMarks($s)
  58.    {
  59.       parent::TextShape($s->getChart());
  60.  
  61.       $this->iSeries = $s;
  62.  
  63.       $tmpColor new Color(255,255,180);  // LIGHT_YELLOW
  64.       $this->getBrush()->setDefaultColor($tmpColor);
  65.  
  66.       $this->textAlign=Array(StringAlignment::$VERTICAL_CENTER_ALIGN,
  67.                             StringAlignment::$HORIZONTAL_CENTER_ALIGN);
  68.  
  69.       $this->getShadow()->setDefaultVisible(true);
  70.       $this->shadow->setDefaultSize(1);
  71.       $this->shadow->getBrush()->setDefaultColor(new Color(128,128,128))// DARK_GRAY
  72.  
  73.       $this->setDefaultVisible(false);
  74.  
  75.       $this->callout new MarksCallout($s);
  76.       $this->callout->setDefaultLength(10);
  77.  
  78.       $this->items new MarksItems($this);
  79.       $this->items->iMarks $this;
  80.  
  81.       $this->readResolve();
  82.    }
  83.  
  84.    protected function readResolve()
  85.    {
  86.       $this->pPositions = new MarkPositions();
  87.       return $this;
  88.    }
  89.  
  90.    /**
  91.    * Marks Callout characteristics.<br>
  92.    * Determines how to draw a line connecting a series mark to its
  93.    * series point.
  94.    *
  95.    * @return MarksCallout 
  96.    */
  97.    public function getCallout()
  98.    {
  99.       return $this->callout;
  100.    }
  101.  
  102.    /**
  103.    * Returns a collection of mark items. <br>
  104.    * Each mark item has its own formatting (color, font, shadow, etc).<br>
  105.    * By default Items are empty, so the default marks formatting is used.
  106.    *
  107.    * @return MarksItems 
  108.    */
  109.    public function getItems()
  110.    {
  111.       return $this->items;
  112.    }
  113.  
  114.    public function setItems($value)
  115.    {
  116.       $this->items $value;
  117.    }
  118.  
  119.    /**
  120.    * Accesses Custom position characteristics for Series Marks. <br>
  121.    * TeeChart for Net has a number of algorithmns that were designed to stop
  122.    * TeeChart SeriesMark overlap. However, if you aren't happy with the
  123.    * automatically generated mark positions, you can always move marks around
  124.    * with code.<br><br>
  125.    * (Remember that you could also use the DragMarks Tool to reposition
  126.    * marks on your Chart.)
  127.    *
  128.    * @return MarkPositions 
  129.    */
  130.    public function getPositions()
  131.    {
  132.       return $this->pPositions;
  133.    }
  134.  
  135.    /**
  136.    * Contains the list of lines drawn on the chart by the user at run-time.
  137.    *
  138.    * @return String[] 
  139.    */
  140.    public function getLines()
  141.    {
  142.       return parent::getLines();
  143.    }
  144.  
  145.    /**
  146.    * Series is a read-only runtime method.<br>
  147.    * It returns the Series component that owns the TSeriesMarks subcomponent.
  148.    * <br>
  149.    * All Series types own a Marks subcomponent of the TSeriesMarks class.
  150.    *
  151.    * @return ISeries 
  152.    */
  153.    public function getSeries()
  154.    {
  155.       return $this->iSeries;
  156.    }
  157.  
  158.    /**
  159.    $Defines $how $Series $Marks $are $static $finalructed.<br>
  160.    * Each different Style value makes Marks output a different text.
  161.    * Several options are available, but you can also use the TChart
  162.    * Series.OnGetMarkText event and override the default Series Marks text.
  163.    * <br>
  164.    * Default value: MarksStyle.Label
  165.    *
  166.    *
  167.    * @return MarksStyle 
  168.    */
  169.    public function getStyle()
  170.    {
  171.       return $this->markerStyle;
  172.    }
  173.  
  174.    /**
  175.    * Defines how Series Marks are constructed.<br>
  176.    * Default value: MarksStyle.Label
  177.    *
  178.    *
  179.    * @param value MarksStyle
  180.    */
  181.    public function setStyle($value)
  182.    {
  183.       if($this->markerStyle != $value)
  184.       {
  185.          $this->markerStyle = $value;
  186.          $this->invalidate();
  187.       }
  188.    }
  189.  
  190.    public function getSymbol()
  191.    {
  192.       if($this->symbol == null)
  193.       {
  194.          $this->symbol new TextShape($this->chart);
  195.          $this->symbol->setVisible(false);
  196.          $this->symbol->setTransparent(false);
  197.          $this->symbol->getShadow()->setWidth(1);
  198.          $this->symbol->getShadow()->setHeight(1);
  199.       }
  200.       return $this->symbol;
  201.    }
  202.  
  203.    public function setChart($value)
  204.    {
  205.       parent::setChart($value);
  206.       if($this->symbol != null)
  207.       {
  208.          $this->symbol->setChart($value);
  209.       }
  210.    }
  211.  
  212.    /**
  213.    * Tells chart to repaint using automatically positioned marks.<br>
  214.    * Turns all Marks positions Custom to false.
  215.    */
  216.    public function resetPositions()
  217.    {
  218.       for($t 0$t sizeof($this->pPositions)$t++)
  219.       {
  220.          $p $this->pPositions->getPosition($t);
  221.          if($p != null)
  222.          {
  223.             $p->custom false;
  224.          }
  225.       }
  226.       $this->invalidate();
  227.    }
  228.  
  229.    /**
  230.    * Removes all mark positions and mark items.
  231.    */
  232.    public function clear()
  233.    {
  234.       $this->pPositions->clear();
  235.       if(!$this->getItems()->iLoadingCustom)
  236.       {
  237.          $this->getItems()->clear();
  238.       }
  239.    }
  240.  
  241.    /**
  242.    * Determines which Mark contains the p point parameters.
  243.    *
  244.    * @param Point
  245.    * @return int 
  246.    */
  247.    public function _clicked($p)
  248.    {
  249.       return $this->clicked($p->x$p->y);
  250.    }
  251.  
  252.    /**
  253.    *  Determines which Mark contains the XY pixel point parameters.
  254.    *
  255.    * @param int
  256.    * @param int
  257.    * @return int the Mark index containing the XY point.
  258.    */
  259.    public function clicked($x$y)
  260.    {
  261.       if($this->iSeries->getChart(!= null)
  262.       {
  263.          $p $this->iSeries->getChart()->getGraphics3D()->calculate2DPosition($x$y,
  264.             $this->getZPosition());
  265.          $x $p->getX();
  266.          $y $p->getY();
  267.       }
  268.  
  269.       $result 0;
  270.       for($t 0$t $this->pPositions->count()$t++)
  271.       {
  272.          $p $this->pPositions->getPosition($t);
  273.          if(($result $this->drawEvery == 0&& ($p != null&&
  274.          ($p->getBounds()->contains($x$y)))
  275.          {
  276.             return $result;
  277.          }
  278.          else
  279.          {
  280.             $result++;
  281.          }
  282.       }
  283.       return 1;
  284.    }
  285.  
  286.    /**
  287.    * Obsolete.&nbsp;Use the Color method instead.
  288.    *
  289.    * @return Color 
  290.    */
  291.    public function getBackColor()
  292.    {
  293.       return $this->getColor();
  294.    }
  295.  
  296.    /**
  297.    * Obsolete.&nbsp;Use the Color method instead.
  298.    *
  299.    * @param value Color
  300.    */
  301.    public function setBackColor($value)
  302.    {
  303.       $this->setColor($value);
  304.    }
  305.  
  306.    /**
  307.    * Obsolete.&nbsp;Use the Pen method instead.
  308.    *
  309.    * @return ChartPen 
  310.    */
  311.    public function getFrame()
  312.    {
  313.       return $this->getPen();
  314.    }
  315.  
  316.    /**
  317.    * The Pen used to draw a line connecting Marks to Series points.<br>
  318.    * Each Series class handles Marks in a different manner, thus the Arrow
  319.    * coordinates are specific to each Series type. <br>
  320.    * By default, Arrow pen is defined to be a White solid pen of 1 pixel
  321.    * width.
  322.    *
  323.    * @return ChartPen 
  324.    */
  325.    public function getArrow()
  326.    {
  327.       return $this->callout->getArrow();
  328.    }
  329.  
  330.    //protected boolean shouldSerializeArrowLength() {
  331.    //    return getArrowLength() != defaultArrowLength;
  332.    //}
  333.  
  334.    /**
  335.    * The length in pixels for the line connecting the Mark to Series point.
  336.    * <br>Default value: 16
  337.    *
  338.    * @return int 
  339.    */
  340.    public function getArrowLength()
  341.    {
  342.       return $this->callout->getLength();
  343.    }
  344.  
  345.    /**
  346.    * Stes the length in pixels of the line connecting the Mark to Series
  347.    * point.<br>
  348.    * Default value: 16
  349.    *
  350.    * @param value int
  351.    */
  352.    public function setArrowLength($value)
  353.    {
  354.       $this->getCallout()->setLength($value);
  355.    }
  356.  
  357.    /**
  358.    * Restricts Marks to Chart axes space, when true.<br>
  359.    * When true, Marks will be drawn only within inner chart boundaries,
  360.    * keeping Axis Labels, Titles, Legend, etc almost untouched.<br>
  361.    * Default value: false
  362.    *
  363.    * @return boolean 
  364.    */
  365.    public function getClip()
  366.    {
  367.       return $this->bClip;
  368.    }
  369.  
  370.    /**
  371.    * Restricts Marks to Chart axes space, when true.<br>
  372.    * Default value: false
  373.    *
  374.    * @param value boolean
  375.    */
  376.    public function setClip($value)
  377.    {
  378.       $this->bClip = $this->setBooleanProperty($this->bClip$value);
  379.    }
  380.  
  381.    /**
  382.    * Characters in Mark texts are split into multiple lines, when true.<br>
  383.    * Default value: false
  384.    *
  385.    * @return boolean 
  386.    */
  387.    public function getMultiLine()
  388.    {
  389.       return $this->multiLine;
  390.    }
  391.  
  392.    /**
  393.    * Characters in Mark texts are split into multiple lines, when true.<br>
  394.    * Default value: false
  395.    *
  396.    * @param value boolean
  397.    */
  398.    public function setMultiLine($value)
  399.    {
  400.       $this->multiLine $this->setBooleanProperty($this->multiLine$value);
  401.    }
  402.  
  403.    /**
  404.    * The number of Marks to skip.<br>
  405.    * Default is 1, all Marks are displayed.
  406.    * Setting it to two will draw every other Mark, to three every third etc.
  407.    * <br>
  408.    * Default value: 1
  409.    *
  410.    * @return int 
  411.    */
  412.    public function getDrawEvery()
  413.    {
  414.       return $this->drawEvery;
  415.    }
  416.  
  417.    /**
  418.    * Sets the number of Marks to skip.<br>
  419.    * Default value: 1
  420.    *
  421.    * @param value int
  422.    */
  423.    public function setDrawEvery($value)
  424.    {
  425.       $this->drawEvery $this->setIntegerProperty($this->drawEvery$value);
  426.    }
  427.  
  428.    /**
  429.    * The angle from 0 to 360 to rotate Marks.<br>
  430.    * Default value: 0
  431.    *
  432.    * @return double 
  433.    */
  434.    public function getAngle()
  435.    {
  436.       return $this->angle;
  437.    }
  438.  
  439.    /**
  440.    * Sets angle from 0 to 360 to rotate Marks.<br>
  441.    * Default value: 0
  442.    *
  443.    * @param value double
  444.    */
  445.    public function setAngle($value)
  446.    {
  447.       $this->angle $this->setDoubleProperty($this->angle$value);
  448.    }
  449.  
  450.    /**
  451.    * The Position in pixels on the Z axis.
  452.    *
  453.    * @return int 
  454.    */
  455.    public function getZPosition()
  456.    {
  457.       return $this->zPosition;
  458.    }
  459.  
  460.    /**
  461.    * Sets Position in pixels on the Z axis.
  462.    *
  463.    * @param value int
  464.    */
  465.    public function setZPosition($value)
  466.    {
  467.       $this->zPosition $this->setIntegerProperty($this->zPosition$value);
  468.    }
  469.  
  470.    public function getTextAlign($value)
  471.    {
  472.       return $this->textAlign;
  473.    }
  474.  
  475.    public function setTextAlign($value)
  476.    {
  477.       $this->textAlign=$value;
  478.    }
  479.  
  480.    private function drawTextLine($lineSt$r$tmpNumRow$tmpRowHeight)
  481.    {
  482.       $tmpP new TeePoint();
  483.       $tmpCenter $r->center();
  484.  
  485.       if($this->angle != 0)
  486.       {
  487.          $tmp $this->angle MathUtils::getPiStep();
  488.          $s sin($tmp);
  489.          $c cos($tmp);
  490.  
  491.          $tmpY $tmpNumRow $tmpRowHeight -
  492.          ($r->getBottom($tmpCenter->y);
  493.          $tmpP->setX($tmpCenter->MathUtils::round($tmpY $s));
  494.  
  495.          if($this->angle == 90)
  496.          {
  497.             $tmpP->setX($tmpP->getX(2);
  498.          }
  499.          $tmpP->setY($tmpCenter->MathUtils::round($tmpY $c));
  500.       }
  501.       else
  502.       {
  503.          $tmpP->setX($tmpCenter->getX());
  504.          $tmpP->setY($r->$tmpNumRow $tmpRowHeight);
  505.  
  506.          if($this->getPen()->getVisible())
  507.          {
  508.             $tmpP->setX($tmpP->getX($this->getPen()->getWidth());
  509.             $tmpP->setY($tmpP->getY($this->getPen()->getWidth());
  510.          }
  511.       }
  512.  
  513.       $g $this->iSeries->getChart()->getGraphics3D();
  514.       $g->setTextAlign($this->textAlign);
  515.  
  516.       if($g->getSupports3DText())
  517.       {
  518.          if($this->angle == 0)
  519.          {
  520.             $g->textOut($tmpP->getX()$tmpP->getY()$this->getZPosition()$lineSt);
  521.          }
  522.          else
  523.          {
  524.             $g->rotateLabel($tmpP->getX()$tmpP->getY(),$this->getZPosition()$lineSt,
  525.             $this->angle);
  526.          }
  527.       }
  528.       else
  529.       {
  530.          if($this->angle == 0{
  531.             $g->textOut($tmpP->getX()$tmpP->getY(),0,$lineSt);
  532.          }
  533.          else {
  534.             $g->rotateLabel($tmpP->getX()$tmpP->getY()0$lineSt$this->angle);
  535.          }
  536.       }
  537.    }
  538.  
  539.    public function allSeriesVisible()
  540.    {
  541.       if($this->chart != null)
  542.       {
  543.          for($t 0$t $this->chart->getSeriesCount()$t++)
  544.          {
  545.             if(!$this->chart->getSeries($t)->getMarks()->getVisible())
  546.             {
  547.                return false;
  548.             }
  549.          }
  550.          return true;
  551.       }
  552.       else
  553.       {
  554.          return $this->getVisible();
  555.       }
  556.    }
  557.  
  558.    public /*protected*/ function applyArrowLength($aPos)
  559.    {
  560.       $tmp $this->callout->getLength($this->callout->getDistance();
  561.       $aPos->leftTop->setY($aPos->leftTop->getY($tmp);
  562.       $aPos->arrowTo->setY($aPos->arrowTo->getY($tmp);
  563.       $aPos->arrowFrom->setY($aPos->arrowFrom->getY($this->callout->getDistance());
  564.       return $aPos;
  565.    }
  566.  
  567.    /**
  568.    * Returns the String showing a "percent" value for a given point.<br>
  569.    * For example: "25%"<br>
  570.    * The optional "AddTotal" parameter, when true, returns: "25% of 1234".
  571.    *
  572.    * @param valueIndex int
  573.    * @param addTotal boolean
  574.    * @return String 
  575.    */
  576.    public function percentString($valueIndex$addTotal)
  577.    {
  578.       $m $this->iSeries->getMandatory();
  579.       $tmp ($m->getTotalABS(!= 0?
  580.       abs($this->iSeries->getMarkValue($valueIndex)) /
  581.       $m->getTotalABS(100;
  582.  
  583.       $tmpResult $this->NumberFormat->getPercentInstance()->format($tmp);
  584.  
  585.       if($addTotal)
  586.       {
  587.          $tmpF $this->multiLine Language::getString("DefaultPercentOf":
  588.             Language::getString("DefaultPercentOf");
  589.          try
  590.          {
  591.             $tmpResult StringFormat::format($tmpF$tmpResult,
  592.             $m->getTotalABS()$this->iSeries->getValueFormat());
  593.          }
  594.          catch(Exception $e)
  595.          {
  596.             $tmpResult StringFormat::format($tmpF$tmpResult,
  597.             $m->getTotalABS()Language::getString("DefValueFormat"));
  598.          }
  599.       }
  600.       return $tmpResult;
  601.    }
  602.  
  603.    private function drawText($r$st)
  604.    {
  605.       $tmpNumRow 0;
  606.       $tmpRowHeight $this->iSeries->getChart()->getGraphics3D()->getFontHeight();
  607.  
  608. // tODO       $i = $st->indexOf($this->Language->getString("LineSeparator"));
  609. // temp line
  610.       $i=-1;
  611.  
  612.       if($i != - 1)
  613.       {
  614.          (int)$this->sepLength strlen(Language::getString("LineSeparator"));
  615.  
  616.          $tmpSt $st;
  617.          do
  618.          {
  619.             $this->drawTextLine($tmpSt->substring(0$i)$r$tmpNumRow,
  620.             $tmpRowHeight);
  621.             $tmpSt $tmpSt->substring($i $this->sepLengthstrlen($tmpSt));
  622.             $tmpNumRow++;
  623.             $i $tmpSt->indexOf(Language::getString("LineSeparator"));
  624.          }
  625.          while($i != - 1);
  626.  
  627.          if(strlen($tmpSt!= 0)
  628.          {
  629.             $this->drawTextLine($tmpSt$r$tmpNumRow$tmpRowHeight);
  630.          }
  631.       }
  632.       else
  633.       {
  634.          $this->drawTextLine($st$r$tmpNumRow$tmpRowHeight);
  635.       }
  636.    }
  637.  
  638.    private function usePosition($index$markPosition)
  639.    {
  640.       while($index >= sizeof($this->pPositions))
  641.       {
  642.           $this->pPositions[]=null;
  643. //          $this->pPositions->append(null);
  644. //         $this->pPositions->add(null);
  645.       }
  646.  
  647.       $tmp null;
  648.  
  649.       if($this->pPositions->getPosition($index== null)
  650.       {
  651.          $tmp new SeriesMarksPosition();
  652.          $tmp->custom false;
  653.          $this->pPositions->setPosition($index$tmp);
  654.       }
  655.       $tmp $this->pPositions->getPosition($index);
  656.  
  657.       if($tmp->custom)
  658.       {
  659.          if($markPosition->arrowFix)
  660.          {
  661.             $old $markPosition->arrowFrom;
  662.             $markPosition->assign($tmp);
  663.             $markPosition->arrowFrom $old;
  664.          }
  665.          else
  666.          {
  667.             $markPosition->assign($tmp);
  668.          }
  669.       }
  670.       else
  671.       {
  672.          $tmp->assign($markPosition);
  673.       }
  674.    }
  675.  
  676.    /**
  677.    * Returns the length in pixels for the ValueIndex th mark text String.<br>
  678.    * It checks if the Mark has multiple lines of text.
  679.    *
  680.    * @param valueIndex int
  681.    * @return int 
  682.    */
  683.    public function textWidth($valueIndex)
  684.    {
  685.       $tmpSt2 "";
  686.       $tmpResult 0;
  687.       $tmpSt $this->iSeries->getMarkText($valueIndex);
  688.       //  TODO $i = $tmpSt->indexOf($this->Language->getString("LineSeparator"));
  689.       // temp line  TODO remove -1
  690.       $i=-1;
  691.  
  692.       if($i 0)
  693.       {
  694.          do
  695.          {
  696.             $tmpSt2 $tmpSt->substring(0$i);
  697.             $tmpResult max($tmpResult,
  698.             $this->iSeries->getChart()->getGraphics3D()->textWidth($tmpSt2));
  699.             $tmpSt $tmpSt->substring($i 1);
  700.             $i $tmpSt->indexOf(Language::getString("LineSeparator"));
  701.          }
  702.          while($i != - 1;
  703.       }
  704.  
  705.       if(strlen($tmpSt!= 0)
  706.       {
  707.          $tmpResult max($tmpResult,
  708.          $this->iSeries->getChart()->getGraphics3D()->textWidth($tmpSt));
  709.       }
  710.  
  711.       return $tmpResult;
  712.    }
  713.  
  714.    protected function convertTo2D($aPos$p)
  715.    {
  716.       if($this->chart->getAspect()->getView3D(&&
  717.       !$this->chart->getGraphics3D()->getSupports3DText())
  718.       {
  719.          $tmpDifX $aPos->arrowTo->getX($p->getX();
  720.          $tmpDifY $aPos->arrowTo->getY($p->getY();
  721.          $tmpPos2D $this->chart->getGraphics3D()->calc3DPoint($aPos->arrowTo->getX(),
  722.             $aPos->arrowTo->getY()$this->getZPosition());
  723.  
  724.          $p->setX($tmpPos2D->getX($tmpDifX);
  725.          $p->setY($tmpPos2D->getY($tmpDifY);
  726.       }
  727.  
  728.       return $p;
  729.    }
  730.  
  731.    private function totalBounds($valueIndex$aPos)
  732.    {
  733.       $result $aPos->getBounds();
  734.       $tmpMark $this->markItem($valueIndex);
  735.  
  736.       if($tmpMark->getPen()->getVisible())
  737.       {
  738.          $result->width += $tmpMark->getPen()->getWidth();
  739.          $result->height += $tmpMark->getPen()->getWidth();
  740.       }
  741.  
  742.       if($tmpMark->getShadow()->getWidth(0)
  743.       {
  744.          $result->width += $tmpMark->getShadow()->getWidth();
  745.       }
  746.       else
  747.          if($tmpMark->getShadow()->getWidth(0)
  748.          {
  749.             $result->-= $tmpMark->getShadow()->getWidth();
  750.          }
  751.  
  752.       if($tmpMark->getShadow()->getHeight(0)
  753.       {
  754.          $result->height += $tmpMark->getShadow()->getHeight();
  755.       }
  756.       else
  757.          if($tmpMark->getShadow()->getHeight(0)
  758.          {
  759.             $result->-= $tmpMark->getShadow()->getHeight();
  760.          }
  761.  
  762.       $p $this->convertTo2D($aPos$result->getLocation());
  763.  
  764.       $tmp $result->$p->getX();
  765.       $result->-= $tmp;
  766.       $result->width -= $tmp;
  767.  
  768.       $tmp $result->getY($p->getY();
  769.       $result->-= $tmp;
  770.       $result->height -= $tmp;
  771.  
  772.       return $result;
  773.    }
  774.  
  775.    public /*protected*/ function antiOverlap($first$valueIndex$aPos)
  776.    {
  777.       $tmpDest new Rectangle();
  778.       $tmpBounds $this->totalBounds($valueIndex$aPos);
  779.  
  780.       for($t $first$t $valueIndex$t++)
  781.       {
  782.          if($this->getPositions()->getPosition($t!= null)
  783.          {
  784.             $tmpR $this->totalBounds($t$this->getPositions()->getPosition($t));
  785.             Rectangle::__intersect($tmpR$tmpBounds$tmpDest);
  786.             if(!$tmpDest->isEmpty())
  787.             {
  788.                $tmpH 0;
  789.  
  790.                if($tmpBounds->getTop($tmpR->getTop())
  791.                {
  792.                   $tmpH $tmpBounds->getBottom($tmpR->y;
  793.                }
  794.                else
  795.                {
  796.                   $tmpH $tmpBounds->$tmpR->getBottom();
  797.                }
  798.  
  799.                $aPos->leftTop->setY($aPos->leftTop->getY($tmpH);
  800.                $aPos->arrowTo->setY($aPos->arrowTo->getY($tmpH);
  801.             }
  802.          }
  803.       }
  804.    }
  805.  
  806.    public /*protected*/ function markItem($valueIndex)
  807.    {
  808.       $result $this;
  809.       if (sizeof($this->getItems()) 0)
  810.       {
  811.         if((sizeof($this->getItems()) $valueIndex&& ($this->getItems()->getItem($valueIndex!= null))
  812.         {
  813.            $result $this->getItems()->getItem($valueIndex);
  814.         }
  815.       }
  816.       return $result;
  817.    }
  818.  
  819.    public /*protected*/ function internalDraw($index$aColor$st$aPos)
  820.    {
  821.       $old_name=TChart::$controlName;       
  822.       TChart::$controlName .='Mark_'
  823.       
  824.       $this->usePosition($index$aPos);
  825.       $c $this->iSeries->getChart();
  826.       $g $c->getGraphics3D();
  827.  
  828.       $tmpMark $this->markItem($index);
  829.  
  830.       $tmp3D $c->getAspect()->getView3D();
  831.  
  832.       if($this->callout->getVisible(|| $this->callout->getArrow()->getVisible())
  833.       {
  834.          $this->callout->draw($aColor$aPos->arrowFrom$aPos->arrowTo,
  835.          $this->getZPosition());
  836.       }
  837.  
  838.       if ($this->getTransparent()) {
  839.          $tmpMark->setTransparent(true);
  840.       }
  841.       else
  842.       {
  843.         if($tmpMark->getTransparent())
  844.         {
  845.          $g->getBrush()->setVisible(false);
  846.         }
  847.         else
  848.         {
  849.          $g->setBrush($tmpMark->getBrush());
  850.         }
  851.       }
  852.  
  853.       $g->setPen($tmpMark->getPen());
  854.       $aPos->leftTop $this->convertTo2D($aPos$aPos->leftTop);
  855.  
  856.       // TODO added extra -2 and +4, ok?
  857.       $frameRect new Rectangle($aPos->leftTop->getX()-2,
  858.           $aPos->leftTop->getY()$aPos->width 4,
  859.           $aPos->height);
  860.  
  861.       $tmpMark->drawRectRotated($g$frameRect(int)($this->angle 360),
  862.            $this->getZPosition());
  863.  
  864.       $tmpSymbol $this->shouldDrawSymbol();
  865.  
  866.       if($tmpSymbol)
  867.       {
  868.          $this->symbol->setColor($this->getSeries()->getValueColor($index));
  869.          $this->symbol->setTransparent(false);
  870.  
  871.          $tmpH $g->getFontHeight();
  872.  
  873.          $this->symbol->setShapeBounds(Rectangle::fromLTRB($aPos->leftTop->getX(4,
  874.          $aPos->leftTop->getY(3,
  875.          $aPos->leftTop->getX($tmpH 1,
  876.          $aPos->leftTop->getY($tmpH 2));
  877.          $this->symbol->drawRectRotated($g$this->symbol->getShapeBounds(),
  878.          (int)($this->angle 360)$this->getZPosition(1);
  879.       }
  880.  
  881.       $g->getBrush()->setVisible(false);
  882.  
  883.       $r $aPos->getBounds();
  884.  
  885.       if($tmpSymbol)
  886.       {
  887.          $tmp $this->symbol->getShapeBounds()->width;
  888.          $r->setX($r->getX($tmp);
  889.          $r->width -= $tmp;
  890.       }
  891.  
  892.       $this->drawText($r$st);
  893.       TChart::$controlName=$old_name;             
  894.    }
  895.  
  896.    function shouldDrawSymbol()
  897.    {
  898.       return($this->symbol != null&& ($this->symbol->getVisible()) &&
  899.       (!$this->symbol->getTransparent());
  900.    }
  901. }
  902.  
  903. ?>

Documentation generated on Wed, 16 Jun 2010 12:08:00 +0200 by phpDocumentor 1.4.1