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

Source for file Axis.php

Documentation is available at Axis.php

  1. <?php
  2.  
  3. /**
  4.  * Axis Class
  5.  *
  6.  * Description: Accesses all Axis 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 axis
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16. class Axis extends TeeBase {
  17.  
  18.     // Private properties
  19.     private $automatic true;
  20.     private $automaticMaximum true;
  21.     private $automaticMinimum true;
  22.     private $desiredIncrement=0;
  23.     private $maximumvalue=0;
  24.     private $minimumvalue=0;
  25.     private $logarithmic=0;
  26.     private $logarithmicBase 10;
  27.     private $maximumOffset=0;
  28.     private $minimumOffset=0;
  29.     private $minorTickCount 3;
  30.     private $minorTicks;
  31.     private $ticks;
  32.     private $ticksInner;
  33.     private $tickonlabelsonly true;
  34.     private $startPosition=0;
  35.     private $endPosition 100;
  36.     private $relativePosition=0;
  37.     private $positionUnits;
  38.     private $labels;
  39.     private $otherSide=false;
  40.     private static $MAXPIXELPOS 32767;
  41.  
  42.     // Protected properties
  43.     protected $minorGrid;
  44.     protected $axisTitle;
  45.     protected $axispen;
  46.     protected $grid;
  47.     protected $inverted=false;
  48.     protected $horizontal=false;
  49.     protected $bVisible = true;
  50.     protected $zPosition=0;
  51.  
  52.     // Public properties
  53.     public $axisDraw;
  54.     public $iMinAxisIncrement=0;
  55.     public static $MINAXISRANGE 0.0000000001;
  56.     public static $AXISCLICKGAP 3// min pixels distance to trigger axis click
  57.     public $posAxis=0;
  58.     public $posTitle=0;
  59.     public $hideBackGrid;
  60.  
  61.     // internal
  62.     public $iAxisDateTime;
  63.     public $iAxisLogSizeRange;
  64.     public $iAxisSizeRange;
  65.     public $iCenterPos=0;
  66.     public $iLogMax;
  67.     public $iLogMin;
  68.     public $iMaximum=0.0;
  69.     public $iMinimum=0.0;
  70.     public $iRange=0.0;
  71.     public $iRangelog=0.0;
  72.     public $iRangezero=false;
  73.     public $iSeriesList;
  74.     public $iStartPos=0.0;
  75.     public $iEndPos=0.0;
  76.     public $iAxisSize;
  77.     public $isDepthAxis=false;
  78.     public $iZPos;
  79.     public $labelIndex;
  80.  
  81.  
  82.     // Class Definition
  83.  
  84.     // Interceptors
  85.     function __get$property {
  86.       $method ="get{$property}";
  87.       if method_exists$this$method ) ) {
  88.         return $this->$method();
  89.       }
  90.     }
  91.  
  92.     function __set $property,$value {
  93.       $method ="set{$property}";
  94.       if method_exists$this$method ) ) {
  95.         return $this->$method($value);
  96.       }
  97.     }
  98.  
  99.     public function internalSetInverted($value{
  100.         $this->inverted = $value;
  101.     }
  102.  
  103.     /**
  104.     * The class constructor.
  105.     */
  106.     public function Axis($horiz=false$isOtherSide=false$chart=null{
  107.         $this->positionUnits PositionUnits::$PERCENT;
  108.  
  109.         parent::__construct($chart);
  110.                
  111.         $this->labels new AxisLabels($this);
  112.         $this->axispen = new AxisLinePen($chart);
  113.         $this->readResolve();
  114.  
  115.         $this->horizontal = $horiz;
  116.         $this->otherSide $isOtherSide;
  117.         $this->labeIndex 0;
  118.     }
  119.  
  120.     protected function readResolve({
  121.         $this->iMinAxisIncrement = 0.000000000001;
  122.         return $this;
  123.     }
  124.  
  125.     private function internalSetMaximum($value{
  126.         $this->maximumvalue $this->setDoubleProperty($this->maximumvalue$value);
  127.     }
  128.  
  129.     private function internalSetMinimum($value{
  130.         $this->minimumvalue $this->setDoubleProperty($this->minimumvalue$value);
  131.     }
  132.  
  133.     public function getRange({
  134.         return $this->iRange;
  135.     }
  136.  
  137.     /**
  138.      * Accesses the Label characteristics of Axis Labels.
  139.      *
  140.      * @return AxisLabels 
  141.      */
  142.     public function getLabels({
  143.         return $this->labels;
  144.     }
  145.  
  146.     /**
  147.      * Returns the custom labels
  148.      *
  149.      * @return AxisLabelsItems 
  150.      */
  151.     public function getCustomLabels({
  152.         return $this->labels->getItems();
  153.     }
  154.  
  155.     /**
  156.      * Calculates Max and Min of axis scale based on associated Series.
  157.      *
  158.      * @return boolean 
  159.      */
  160.     public function getAutomatic({
  161.         return $this->automatic;
  162.     }
  163.  
  164.     /**
  165.     * Description Max and Min of axis scale based on associated Series.
  166.     * @param boolean $value 
  167.     */
  168.     public function setAutomatic($value{
  169.         $this->automatic $this->setBooleanProperty($this->automatic$value);
  170.         $this->automaticMinimum $value;
  171.         $this->automaticMaximum $value;
  172.     }
  173.  
  174.     protected function shouldSerializeHorizontal({
  175.         return $this->isCustom();
  176.     }
  177.  
  178.     /**
  179.      * Determines the Custom axis to be drawn horizontally.
  180.      *
  181.      * @return boolean 
  182.      */
  183.     public function getHorizontal({
  184.         return $this->horizontal;
  185.     }
  186.  
  187.     /**
  188.      * Sets a custom axis to be drawn horizontally.
  189.      *
  190.      * @param $value boolean
  191.      */
  192.     public function setHorizontal($value{
  193.         $this->horizontal = $this->setBooleanProperty($this->horizontal$value);
  194.     }
  195.  
  196.     protected function shouldSerializeOtherSide({
  197.         return $this->isCustom();
  198.     }
  199.  
  200.     /**
  201.      * Positions the Axis labels to the Otherside of the axis.<br> For instance,
  202.      * moves labels on a vertical Axis to the right of the Axis. This is
  203.      * useful when adding a Custom Axis, to place the labelling to the Right
  204.      * for a right vertical Axis, or to the Top for a Top Axis.
  205.      *
  206.      * @return boolean 
  207.      */
  208.     public function getOtherSide({
  209.         return $this->otherSide;
  210.     }
  211.  
  212.     /**
  213.      * Sets the Axis labels to the Otherside of the axis.
  214.      *
  215.      * @param $value boolean
  216.      */
  217.     public function setOtherSide($value{
  218.         $this->otherSide $this->setBooleanProperty($this->otherSide$value);
  219.     }
  220.  
  221.     /**
  222.      * Internal use.
  223.      */
  224.     public function internalCalcRange({
  225.         $this->iRange = $this->iMaximum - $this->iMinimum;
  226.         $this->iRangezero = $this->iRange == 0;
  227.         $this->iAxisSizeRange = $this->iRangezero ? $this->iAxisSize / $this->iRange;
  228.  
  229.         if ($this->logarithmic{
  230.             $this->iLogMin = ($this->iMinimum <= 0log($this->iMinimum);
  231.             $this->iLogMax = ($this->iMaximum <= 0log($this->iMaximum);
  232.             $this->iRangelog = $this->iLogMax - $this->iLogMin;
  233.             $this->iAxisLogSizeRange = ($this->iRangelog == 0:
  234.                                 $this->iAxisSize / $this->iRangelog;
  235.         }
  236.  
  237.         $this->iZPos = $this->calcZPos();
  238.     }
  239.  
  240.     // Returns FloatRange
  241.     private function reCalcAdjustedMinMax($pos1$pos2{
  242.         $oldStart $this->iStartPos;
  243.         $oldEnd $this->iEndPos;
  244.         $this->iStartPos += $pos1;
  245.         $this->iEndPos -= $pos2;
  246.         $this->iAxisSize = $this->iEndPos - $this->iStartPos;
  247.  
  248.         return new FloatRange($this->calcPosPoint($oldStart)$this->calcPosPoint($oldEnd));
  249.     }
  250.  
  251.     /**
  252.      * Called internally to recalculate the max and min $values using the
  253.      * Rect parameter positions.<br>
  254.      * The Rect parameter determines in pixels the margins to apply to
  255.      * ChartRect. The Axis recalculates the appropiate maximum and minimum
  256.      * $values using the Rect parameter positions.
  257.      *
  258.      * @param rect Rectangle
  259.      */
  260.     public function adjustMaxMinRect($rect{
  261.         $tmp=new FloatRange();
  262.  
  263.         if ($this->horizontal{
  264.             $tmp $this->reCalcAdjustedMinMax($rect->x$rect->getRight());
  265.         else {
  266.             $tmp $this->reCalcAdjustedMinMax($rect->y$rect->getBottom());
  267.         }
  268.  
  269.         $this->internalCalcPositions();
  270.         $this->iMaximum = $tmp->max;
  271.         $this->iMinimum = $tmp->min;
  272.  
  273.         if ($this->iMinimum > $this->iMaximum// swap
  274.             $tmp2 $this->iMinimum;
  275.             $this->iMinimum = $this->iMaximum;
  276.             $this->iMaximum = $tmp2;
  277.         }
  278.  
  279.         $this->internalCalcRange();
  280.     }
  281.  
  282.     /**
  283.      * Returns true if Axis is a Custom Axis
  284.      *
  285.      * @return boolean 
  286.      */
  287.     public function isCustom({
  288.         return $this->chart->isAxisCustom($this);
  289.     }
  290.  
  291.     /**
  292.      * Calculates Maximum and Minimum $values based on Max and Min $values of
  293.      * the dependent Series.<br>
  294.      * AdjustMaxMin is automatically called if Axis.Automatic is true.
  295.      * The Chart Zoom.Undo method calls AdjustMaxMin for Left, Right,Top
  296.      * and Bottom axis.
  297.      */
  298.     public function adjustMaxMin({
  299.         $tmp new FloatRange();
  300.         $this->calcMinMax($tmp);
  301.         $this->minimumvalue $tmp->min;
  302.         $this->maximumvalue $tmp->max;
  303.         $this->iMaximum = $this->maximumvalue;
  304.         $this->iMinimum = $this->minimumvalue;
  305.         $this->internalCalcRange();
  306.     }
  307.  
  308.     private function setAutoMinMax($variable$var2,  $value{
  309.         $variable $this->setBooleanProperty($variable$value);
  310.         if ($value{
  311.             // if both are automatic, then Automatic should be True too
  312.             if ($var2{
  313.                 $this->automatic true;
  314.             }
  315.         else {
  316.             $this->automatic false;
  317.         }
  318.         return $variable;
  319.     }
  320.  
  321.     /**
  322.      * Controls if Axis will adjust the Maximum $value automatically based on
  323.      * the maximum $value of its associated Series.<br>
  324.      * Default $value: true
  325.      *
  326.      * @return boolean 
  327.      */
  328.     public function getAutomaticMaximum({
  329.         return $this->automaticMaximum;
  330.     }
  331.  
  332.     /**
  333.      * The Axis adjusts the Maximum $value automatically based on the maximum
  334.      * $value of its associated Series when true.<br>
  335.      * Default $value: true
  336.      *
  337.      * @param $value boolean
  338.      */
  339.     public function setAutomaticMaximum($value{
  340.         $this->automaticMaximum $this->setAutoMinMax($this->automaticMaximum$this->automaticMinimum,
  341.                                          $value);
  342.     }
  343.  
  344.     /**
  345.      * Controls minimum $value automatically based on the minimum $value of
  346.      * its associated Series.<br>
  347.      * Default $value: true
  348.      *
  349.      * @return boolean 
  350.      */
  351.     public function getAutomaticMinimum({
  352.         return $this->automaticMinimum;
  353.     }
  354.  
  355.     /**
  356.      * The Axis adjusts the Minimum $value automatically based on the maximum
  357.      * $value of its associated Series when true.<br>
  358.      * Default $value: true
  359.      *
  360.      * @param $value boolean
  361.      */
  362.     public function setAutomaticMinimum($value{
  363.         $this->automaticMinimum $this->setAutoMinMax($this->automaticMinimum$this->automaticMaximum,
  364.                                          $value);
  365.     }
  366.  
  367.     /**
  368.      * Determines the kind of pen used to draw the major Axis lines.<br>
  369.      * These are the lines which go from Axis Minimum to Axis Maximum screen
  370.      * positions.
  371.      *
  372.      * @return AxisLinePen 
  373.      */
  374.     public function getAxisPen({
  375.         return $this->axispen;
  376.     }
  377.  
  378.     /**
  379.      * Determines the kind of pen used to draw the Grid lines at every Axis
  380.      * Label position.<br> These are the lines which go from "cousin Axis"
  381.      * Minimum to "cousin Axis" Maximum screen positions for each Label
  382.      * position.<br>
  383.      * Use the MinorGrid property to make the Grid from Minor Ticks visible.
  384.      *
  385.      * @return GridPen 
  386.      */
  387.     public function getGrid({
  388.         if ($this->grid == null{
  389.             $this->grid = new GridPen($this->chart);
  390.         }
  391.         return $this->grid;
  392.     }
  393.  
  394.     /**
  395.      * Obsolete.&nbsp;Please use Labels.<!-- -->OnAxis instead.
  396.      *
  397.      * @return boolean 
  398.      */
  399.     public function getLabelsOnAxis({
  400.         return $this->labels->bOnAxis;
  401.     }
  402.  
  403.     /**
  404.      * Obsolete.&nbsp;Please use Labels.<!-- -->OnAxis instead.
  405.      *
  406.      * @param $value boolean
  407.      */
  408.     public function setLabelsOnAxis($value{
  409.         $this->labels->bOnAxis $value;
  410.     }
  411.  
  412.    /**
  413.      * Returns if the Axis dependent $values are DateTime or not. <br>
  414.      * Each Chart Axis can consider $values to be normal numbers or DateTime
  415.      * $values. An axis is "DateTime" if at least one Active Series with
  416.      * datetime $values is associated to it.<br>
  417.      * Default $value: false
  418.      *
  419.      * @return boolean 
  420.      */
  421.     public function isDateTime({
  422.         for ($t 0$t $this->chart->getSeriesCount()$t++{
  423.             $s $this->chart->getSeries($t);
  424.             if ($s->getActive()) {
  425.                 if ($s->associatedToAxis($this)) {
  426.                     return $this->getHorizontal($s->getXValues()->getDateTime(:
  427.                             $s->getYValues()->getDateTime();
  428.                 }
  429.             }
  430.         }
  431.         return false;
  432.     }
  433.  
  434.     /**
  435.      * Determines the minimum step between axis labels.<br>
  436.      * Can use DateTimeStep for date-time axis. It must be a positive number
  437.      * or DateTime $value. TChart will use this $value as the inicial axis label
  438.      * step. If there is not enough space for all labels, TChart will calculate
  439.      * a bigger one. You can use the DateTimeStep constant array for DateTime
  440.      * increments.
  441.      *
  442.      *
  443.      * @return double 
  444.      */
  445.     public function getIncrement({
  446.         return $this->desiredIncrement;
  447.     }
  448.  
  449.     /**
  450.      * Sets the minimum step between axis labels.
  451.      *
  452.      * @param $value double
  453.      */
  454.     public function setIncrement($value{
  455.  
  456.         /** @todo RAISING EXCEPTIONS HERE FORCES DECLARING "THROW" EVERYWHERE!  */
  457. //        if ($value < 0) {
  458. //            throw new TeeChartException(Language.getString("AxisIncrementNeg"));
  459. //        }
  460.  
  461.         //if (isDateTime()) System.Convert.ToDateTime($value).ToString();
  462.         $this->desiredIncrement $this->setDoubleProperty($this->desiredIncrement$value);
  463.     }
  464.  
  465.     /**
  466.      * Swaps the Axis Minimum and Maximum scales.<br>
  467.      * When true, Axis Minimum and Maximum scales will be swapped. Axis labels
  468.      * and Series points will be displayed accordingly. This applies both to
  469.      * vertical and horizontal axis.<br>
  470.      * Default $value: false
  471.      *
  472.      * @return boolean 
  473.      */
  474.     public function getInverted({
  475.         return $this->inverted;
  476.     }
  477.  
  478.     /**
  479.      * Swaps the Axis Minimum and Maximum scales when true.<br>
  480.      * Default $value: false
  481.      *
  482.      * @param $value boolean
  483.      */
  484.     public function setInverted($value{
  485.         $this->inverted = $this->setBooleanProperty($this->inverted$value);
  486.         if ($this->isDepthAxis{
  487.             if ($this == $this->getChart()->getAxes()->getDepth())
  488.                 $this->chart->getAxes()->getDepthTop()->inverted $this->getInverted();
  489.             else
  490.                 $this->chart->getAxes()->getDepth()->inverted $this->getInverted();
  491.         }
  492.     }
  493.  
  494.     /**
  495.      * Scales the Axis Logarithmically when true.<br>
  496.      * Axis Minimum and Maximum $values should be greater than 0, and Axis
  497.      * cannot be of DateTime type.<br>
  498.      * Default $value: false
  499.      *
  500.      * @return boolean 
  501.      */
  502.     public function getLogarithmic({
  503.         return $this->logarithmic;
  504.     }
  505.  
  506.     /**
  507.      * Scales the Axis Logarithmically when true.<br>
  508.      * Default $value: false
  509.      *
  510.      * @param $value boolean
  511.      * @throws TeeChartException
  512.      */
  513.     public function setLogarithmic($value/*throws ChartException*/ {
  514.         if ($this->chart != null//CDI for custom axes at designtime this $value is
  515.             //sometimes null.
  516.             if (($value&& ($this->isDateTime())) {
  517.                 throw new ChartException(Language::getString("AxisLogDateTime"));
  518.             }
  519.  
  520.             if ($value{
  521.                 $this->adjustMaxMin();
  522.                 if (($this->iMinimum < 0|| ($this->iMaximum < 0)) {
  523.                     throw new ChartException(Language::getString("AxisLogNotPositive"));
  524.                 }
  525.             }
  526.         }
  527.  
  528.         $this->logarithmic $this->setBooleanProperty($this->logarithmic$value);
  529.     }
  530.  
  531.     protected function shouldSerializeMaximum({
  532.         return (!$this->automatic&& (!$this->automaticMaximum);
  533.     }
  534.  
  535.     /**
  536.      * Amount of pixels that will be left as a margin at axis maximum
  537.      * position.<br>
  538.      * It is useful when you don't want the series to display points very
  539.      * close to axis boundaries. <br>
  540.      * Default $value: 0
  541.      * <br><br>
  542.      * Example:
  543.      * <pre><font face="Courier" size="4">
  544.      * myChart.getAxes().getBottom().setMaximumOffset(4);
  545.      * myChart.getAxes().getBottom().setMinimumOffset(4);
  546.      * </font></pre>
  547.      *
  548.      * @return int 
  549.      */
  550.     public function getMaximumOffset({
  551.         return $this->maximumOffset;
  552.     }
  553.  
  554.     /**
  555.      * Sets the amount of pixels that will be left as a margin at axis maximum
  556.      * position.<br>
  557.      * Default $value: 0
  558.      *
  559.      * @param $value int
  560.      */
  561.     public function setMaximumOffset($value{
  562.         $this->maximumOffset $this->setIntegerProperty($this->maximumOffset$value);
  563.     }
  564.  
  565.     /**
  566.      * The highest $value an Axis will use to scale their dependent Series
  567.      * posvalues.<br>
  568.      * It can be any number or DateTime $value. It must be greater than the
  569.      * Axis.Minimum $value.<br><br>
  570.      * VERY IMPORTANT: <br>
  571.      * Axis.Automatic property must be FALSE. If Axis.Automatic is true,
  572.      * the Axis will set Maximum and Minimum $values to Maximum and Minimum
  573.      * dependent Series $values.
  574.      *
  575.      * @return double 
  576.      */
  577.     public function getMaximum({
  578.         return $this->maximumvalue;
  579.     }
  580.  
  581.     /**
  582.      * Sets the highest $value an Axis will use to scale their dependent Series
  583.      * posvalues.<br>
  584.      *
  585.      * @param $value double
  586.      */
  587.     public function setMaximum($value{
  588.         $this->internalSetMaximum($value);
  589.     }
  590.  
  591.     protected function shouldSerializeMinimum({
  592.         return (!$this->automatic&& (!$this->automaticMinimum);
  593.     }
  594.  
  595.     /**
  596.      * Advanced use. Smallest Axis calculation increment.<br>
  597.      * Default $value: 1e-12
  598.      *
  599.      * @return double 
  600.      */
  601.     public function getMinAxisIncrement({
  602.         return $this->iMinAxisIncrement;
  603.     }
  604.  
  605.     /**
  606.      * Advanced use. Determines the smallest Axis calculation increment.<br>
  607.      * Default $value: 1e-12
  608.      *
  609.      * @param $value double
  610.      */
  611.     public function setMinAxisIncrement($value{
  612.         $this->iMinAxisIncrement = $value;
  613.     }
  614.  
  615.     /**
  616.      * The lowest $value an Axis will use to scale their dependent Series
  617.      * povalues.<br>
  618.      * It can be any number or DateTime $value. It must be lower than the
  619.      * Axis.Maximum $value. <br><br>
  620.      * VERY IMPORTANT: <br>
  621.      * Axis.Automatic property must be FALSE. If Axis.Automatic is true,
  622.      * the Axis will set Maximum and Minimum $values to Maximum and Minimum
  623.      * dependent Series $values.
  624.      *
  625.      * @return double 
  626.      */
  627.     public function getMinimum({
  628.         return $this->minimumvalue;
  629.     }
  630.  
  631.     /**
  632.      * Sets the lowest $value an Axis will use to scale their dependent Series
  633.      * possvalues.<br>
  634.      *
  635.      * @param $value double
  636.      */
  637.     public function setMinimum($value{
  638.         $this->internalSetMinimum($value);
  639.     }
  640.  
  641.     /**
  642.      * The number of pixels that will be left as a margin at axis minimum
  643.      * position.<br>
  644.      * It is useful when you don't want the series to display points very close
  645.      * to axis boundaries.<br>
  646.      * Default $value: 0 <br>
  647.      *
  648.      * @return int 
  649.      */
  650.     public function getMinimumOffset({
  651.         return $this->minimumOffset;
  652.     }
  653.  
  654.     /**
  655.      * Determines the number of pixels that will be left as a margin at axis
  656.      * minimum position.<br>
  657.      * Default $value: 0 <br>
  658.      *
  659.      * @param $value int
  660.      */
  661.     public function setMinimumOffset($value{
  662.         $this->minimumOffset $this->setIntegerProperty($this->minimumOffset$value);
  663.     }
  664.  
  665.     /**
  666.      * The number of Axis minor ticks between major ticks.<br>
  667.      * Axis minor ticks are the Axis sub-ticks between major ticks. It should
  668.      * be a positive number greater than zero and less than half the number
  669.      * of pixels between major ticks, otherwise Minor ticks will "overlap".<br>
  670.      * Default $value: 3
  671.      *
  672.      * @return int 
  673.      */
  674.     public function getMinorTickCount({
  675.         return $this->minorTickCount;
  676.     }
  677.  
  678.     /**
  679.      * Determines the number of Axis minor ticks between major ticks.<br>
  680.      * Default $value: 3
  681.      *
  682.      * @param $value int
  683.      */
  684.     public function setMinorTickCount($value{
  685.         $this->minorTickCount $this->setIntegerProperty($this->minorTickCount$value);
  686.     }
  687.  
  688.     /**
  689.      * Determines the Pen used to draw the Axis Minor ticks.<br>
  690.      * Minor ticks will only be displayed if MinorTicks.Visible is true.<br>
  691.      *
  692.      * @return TicksPen 
  693.      */
  694.     public function getMinorTicks({
  695.         if ($this->minorTicks == null{
  696.             $this->minorTicks new TicksPen($this->chart);
  697.             $this->minorTicks->length 2;
  698.             $this->minorTicks->defaultLength 2;
  699.         }
  700.         return $this->minorTicks;
  701.     }
  702.  
  703.     public function setMinorTicks($value{
  704.             $this->minorTicks=$value;
  705.     }
  706.     /**
  707.      * Obsolete.&nbsp;Please use Position instead.
  708.      *
  709.      * @return int 
  710.      */
  711.     public function getPosAxis({
  712.         return $this->posAxis;
  713.     }
  714.  
  715.     /**
  716.      * Determines the screen co-ordinate where axis is drawn.<br>
  717.      * It returns the position of the Axis in pixels relative to the Chart
  718.      * Panel. For horizontal axes the number is a Y position, for vertical
  719.      * axes an X position. <br>
  720.      * Default $value: 0
  721.      *
  722.      * @return int 
  723.      */
  724.     public function getPosition({
  725.         return $this->posAxis;
  726.     }
  727.  
  728.     /**
  729.      * The Axis Ticks and Axis Grid to be drawn only coincide at Labels.<br>
  730.      * Otherwise, they will be drawn at all axis increment positions.
  731.      * When the Axis.Labels.Separation property is greater than 0 (default 10),
  732.      * Axis increases the increment property to afunction Axis Label overlap.<br>
  733.      * Default $value: true
  734.      *
  735.      * @return boolean 
  736.      */
  737.     public function getTickOnLabelsOnly({
  738.         return $this->tickonlabelsonly;
  739.     }
  740.  
  741.     /**
  742.      * Sets the Axis Ticks and Axis Grid to be drawn to only coincide at
  743.      * Labels.<br>
  744.      * Default $value: true
  745.      *
  746.      * @param $value boolean
  747.      */
  748.     public function setTickOnLabelsOnly($value{
  749.         $this->tickonlabelsonly $this->setBooleanProperty($this->tickonlabelsonly$value);
  750.     }
  751.  
  752.     /**
  753.      * Determines the kind of Pen used to draw Axis marks along the Axis line.
  754.      * <br>
  755.      * Ticks position is calculated based on Axis.Increment,
  756.      * Axis.Labels.Separation and Axis.Label.Style methods.<br>
  757.      * There are three kind of ticks available:  Ticks, MinorTicks and
  758.      * TicksInner.<br> You can show or hide any of them of have all of them
  759.      * Visible. Ticks.Length defines the length of Axis Ticks in logical pixels.
  760.      *
  761.      * @return TicksPen 
  762.      */
  763.     public function getTicks({
  764.         if ($this->ticks == null{
  765.             $this->ticks new TicksPen($this->chart);
  766.             $this->ticks->length=4;
  767.             $this->ticks->defaultLength 4;
  768.         }
  769.  
  770.         return $this->ticks;
  771.     }
  772.  
  773.     public function setTicks($value{
  774.             $this->ticks=$value;
  775.     }
  776.  
  777.     /**
  778.      * Determines the kind of Pen used to draw Axis marks along the Axis line.
  779.      * <br>
  780.      * This does the same as Ticks, but lines are drawn inside Chart boundaries
  781.      * instead. TicksInner position is calculated based on Axis.Increment,
  782.      * Axis.Labels.Separation and Axis.Label.Style.<br> There are three kind of
  783.      * ticks available:  Ticks, MinorTicks and TicksInner.<br> You can show or
  784.      * hide any of them of have all of them Visible. TickInnerLength defines
  785.      * the length of Axis TicksInner in logical pixels.
  786.      *
  787.      * @return TicksPen 
  788.      */
  789.     public function getTicksInner({
  790.         if ($this->ticksInner == null{
  791.             $this->ticksInner new TicksPen($this->chart);
  792.         }
  793.         return $this->ticksInner;
  794.     }
  795.  
  796.     /**
  797.      * An Axis sub-class used to define Title attributes.<br>
  798.      * Axis Titles are a string of text drawn near Axes. Use Text to specify
  799.      * Axis Title text.<br>
  800.      * Use Font and Angle to set the format desired.
  801.      *
  802.      * @return AxisTitle 
  803.      */
  804.     public function getTitle({
  805.         if ($this->axisTitle == null{
  806.             $this->axisTitle = new AxisTitle($this->chart);
  807.             if ($this->horizontal)
  808.                $this->axisTitle->setAngle(0);
  809.             else
  810.                $this->axisTitle->setAngle(90);            
  811.         }
  812.         return $this->axisTitle;
  813.     }
  814.  
  815.     public function setTitle($value{
  816.         $this->axisTitle = $value;
  817.     }
  818.  
  819.     /**
  820.      * Obsolete.&nbsp;Please use Axis.<!-- -->Title.<!-- -->CustomSize
  821.      *
  822.      * @return int 
  823.      */
  824.     public function getTitleSize({
  825.         return $this->getTitle()->getCustomSize();
  826.     }
  827.  
  828.     /**
  829.      * Obsolete.&nbsp;Please use Axis.<!-- -->Title.<!-- -->CustomSize
  830.      *
  831.      * @param $value int
  832.      */
  833.     public function setTitleSize($value{
  834.         $this->getTitle()->setCustomSize($value);
  835.     }
  836.  
  837.     /**
  838.      * Shows or hides the Axis lines, ticks, grids, labels and title.<br>
  839.      * You can change it both at design and runtime.<br>
  840.      * Default $value: true
  841.      *
  842.      * @return boolean 
  843.      */
  844.     public function getVisible({
  845.         return $this->bVisible;
  846.     }
  847.  
  848.     /**
  849.      * Shows the Axis lines, ticks, grids, labels and title when true.<br>
  850.      * Default $value: true
  851.      *
  852.      * @param $value boolean
  853.      */
  854.     public function setVisible($value{
  855.         $this->bVisible = $this->setBooleanProperty($this->bVisible$value);
  856.     }
  857.  
  858.     protected function shouldSerializeZPosition({
  859.         return (!$this->isDepthAxis&&
  860.                 (
  861.                         ($this->getOtherSide(&& ($this->zPosition != 100)) ||
  862.                         ((!$this->getOtherSide()) && ($this->zPosition != 0))
  863.                 );
  864.     }
  865.  
  866.     /**
  867.      * Determines the Z axis position along chart Depth as a percentage of the
  868.      * total depth.<br>
  869.      * It can even be set to negative $values to place the axis in front of the
  870.      * Chart, or $values greater than 100% to place the axis behind the Chart.
  871.      * In 3D or orthogonal display modes, ZPosition controls where to display
  872.      * the axis line. It useful if you want to move axis to front or to back
  873.      * in 3D view.<br>
  874.      *
  875.      * @return double 
  876.      */
  877.     public function getZPosition({
  878.         return $this->zPosition;
  879.     }
  880.  
  881.     /**
  882.      * Sets the Z axis position along chart Depth as a percentage of the
  883.      * total depth.<br>
  884.      *
  885.      * @param $value double
  886.      */
  887.     public function setZPosition($value{
  888.         $this->zPosition = $this->setDoubleProperty($this->zPosition$value);
  889.     }
  890.  
  891.     /**
  892.      * Obsolete.&nbsp;Please use Axis.<!-- -->Grid.<!-- -->Centered property
  893.      *
  894.      * @return boolean 
  895.      */
  896.  
  897.     public function getGridCentered({
  898.         return $this->getGrid()->centered;
  899.     }
  900.  
  901.     /**
  902.      * Obsolete.&nbsp;Please use Axis.<!-- -->Grid.<!-- -->Centered property
  903.      *
  904.      * @param $value boolean
  905.      */
  906.     public function setGridCentered($value{
  907.         $this->getGrid()->setCentered($value);
  908.     }
  909.  
  910.     /**
  911.      * Determines the Axis position as percentage 0-100% of the Chart.<br>
  912.      * 0 being Top for a horizontal Axis and Left for a vertical Axis.
  913.      *
  914.      * @return double 
  915.      */
  916.     public function getRelativePosition({
  917.         return $this->relativePosition;
  918.     }
  919.  
  920.     /**
  921.      * Determines the Axis position as percentage 0-100% of the Chart.<br>
  922.      *
  923.      * @param $value double
  924.      */
  925.     public function setRelativePosition($value{
  926.         $this->relativePosition $this->setDoubleProperty($this->relativePosition$value);
  927.     }
  928.  
  929.     /**
  930.      * Defines axis Position units (pixels or percentage).<br>
  931.      * When PositionUnits is Percent, Position $value is a percentage of total
  932.      * chart size. <br>
  933.      * When PositionUnits is Pixels, Position is considered in pixels. <br>
  934.      * Default $value: Percent
  935.      *
  936.      * @return PositionUnits 
  937.      */
  938.     public function getPositionUnits({
  939.         return $this->positionUnits;
  940.     }
  941.  
  942.     /**
  943.      * Determines the axis Position units (pixels or percentage).<br>
  944.      * Default $value: Percent
  945.      *
  946.      * @param $value PositionUnits
  947.      */
  948.     public function setPositionUnits($value{
  949.         if ($this->positionUnits != $value{
  950.             $this->positionUnits $value;
  951.             $this->invalidate();
  952.         }
  953.     }
  954.  
  955.     /**
  956.      * Axis Start position on its own Axis expressed as a percentage.<br>
  957.      * For a vertical Axis a StartPosition of 75 would place the top of
  958.      * the Axis 75% down the Chart.<br>
  959.      * Default $value: 0%
  960.      *
  961.      * @return double 
  962.      */
  963.     public function getStartPosition({
  964.         return $this->startPosition;
  965.     }
  966.  
  967.     /**
  968.      * Sets the Axis Start position on its own Axis expressed as a percentage.
  969.      * <br>
  970.      * Default $value: 0%
  971.      *
  972.      * @param $value double
  973.      */
  974.     public function setStartPosition($value{
  975.         $this->startPosition $this->setDoubleProperty($this->startPosition$value);
  976.     }
  977.  
  978.     /**
  979.      * Axis End Position on its own Axis expressed as a percentage (0-100%).<br>
  980.      * For a Vertical Axis a $value of 75% would place the beginning of the
  981.      * scale at 75% down from Top.<br>
  982.      * Default $value: 100%
  983.      *
  984.      * @return double 
  985.      */
  986.     public function getEndPosition({
  987.         return $this->endPosition;
  988.     }
  989.  
  990.     /**
  991.      * Sets the Axis End Position on its own Axis expressed as a percentage.<br>
  992.      * Default $value: 100%
  993.      *
  994.      * @param $value double
  995.      */
  996.     public function setEndPosition($value{
  997.         $this->endPosition $this->setDoubleProperty($this->endPosition$value);
  998.     }
  999.  
  1000.     /**
  1001.      * The base for the Logarithmic scale when Axis Logarithmic = true.
  1002.      *
  1003.      * @return double 
  1004.      */
  1005.     public function getLogarithmicBase({
  1006.         return $this->logarithmicBase;
  1007.     }
  1008.  
  1009.     /**
  1010.      * Sets the base for the Logarithmic scale when Axis Logarithmic = true.
  1011.      *
  1012.      * @param $value double
  1013.      */
  1014.     public function setLogarithmicBase($value{
  1015.         $this->logarithmicBase $this->setDoubleProperty($this->logarithmicBase$value);
  1016.     }
  1017.  
  1018.     /**
  1019.      * Characteristics of the Grid coincidental to Minor Ticks.<br>
  1020.      * The Minor Grid.Visible is false as default.
  1021.      *
  1022.      * @return ChartPen 
  1023.      */
  1024.     public function getMinorGrid({
  1025.         if ($this->minorGrid == null{
  1026.             $this->minorGrid = new ChartPen($this->chartnew Color(0,0,0)false);
  1027.             $this->minorGrid->setDefaultStyle(DashStyle::$DOT);
  1028.         }
  1029.         return $this->minorGrid;
  1030.     }
  1031.  
  1032.     //methods
  1033.     // Returns string
  1034.     public function titleOrName({
  1035.         $tmpResult $this->getTitle()->getCaption();
  1036.         if ($tmpResult->length(== 0{
  1037.             if ($this->isDepthAxis{
  1038.                 if ($this== $this->getChart()->getAxes()->getDepth())
  1039.                     return Language::getString("DepthAxis");
  1040.                 else
  1041.                 if ($this == $this->getChart()->getAxes()->getDepthTop())
  1042.                     return Language::getString("DepthTopAxis");
  1043.             else {
  1044.                 if ($this->horizontal{
  1045.                     if ($this->otherSide{
  1046.                         return Language::getString("TopAxis");
  1047.                     else {
  1048.                         return Language::getString("BottomAxis");
  1049.                     }
  1050.                 else {
  1051.                     if ($this->otherSide{
  1052.                         return Language::getString("RightAxis");
  1053.                     else {
  1054.                         return Language::getString("LeftAxis");
  1055.                     }
  1056.                 }
  1057.             }
  1058.         }
  1059.         return $tmpResult;
  1060.     }
  1061.  
  1062.     /**
  1063.      * Returns the minimum and maximum $values of the associated Series.
  1064.      *
  1065.      * @param tmp FloatRange
  1066.      */
  1067.     public function calcMinMax($tmp{
  1068.  
  1069.         if ($this->automatic || $this->automaticMaximum{
  1070.             $tmp->max $this->chart->internalMinMax($thisfalse$this->horizontal);
  1071.         else {
  1072.             $tmp->max $this->maximumvalue;
  1073.         }
  1074.  
  1075.         if ($this->automatic || $this->automaticMinimum{
  1076.             $tmp->min $this->chart->internalMinMax($thistrue$this->horizontal);
  1077.         else {
  1078.             $tmp->min $this->minimumvalue;
  1079.         }
  1080.     }
  1081.  
  1082.     private function maxLabelsValueWidth({
  1083.         if (($this->isDateTime(&& $this->labels->getExactDateTime()) ||
  1084.             $this->labels->getRoundFirstLabel()) {
  1085.             $tmp $this->getCalcIncrement();
  1086.             $tmpA round($tmp (($this->iMinimum / $tmp)));
  1087.             $tmpB round($tmp (($this->iMaximum / $tmp)))//MM error on 'small'(20x20) chart with int32
  1088.         else {
  1089.             $tmpA $this->iMinimum;
  1090.             $tmpB $this->iMaximum;
  1091.         }
  1092.  
  1093.         //MM pending
  1094.         //            GetAxisLabelEventHandler oldGetAxisLabel;
  1095.         //            if (chart.getParent()!=null) oldGetAxisLabel=chart.getParent().GetAxisLabel;
  1096.         //            GetAxisLabel=null;
  1097.  
  1098.         $tmpResult ($this->chart->getGraphics3D()->textWidth(" "+
  1099.                          max($this->chart->multiLineTextWidth(
  1100.                                  $this->labels->labelValue($tmpA))->width,
  1101.                                   $this->chart->multiLineTextWidth($this->labels->labelValue($tmpB))->width));
  1102.  
  1103.         return $tmpResult;
  1104.     }
  1105.  
  1106.     /**
  1107.      * Returns the maximum width in pixels of all Axis Labels.
  1108.      *
  1109.      * @return int 
  1110.      */
  1111.     public function maxLabelsWidth({
  1112.         if ($this->getLabels()->getItems()->count(== 0{
  1113.             $tmpStyle $this->calcLabelStyle();
  1114.             if ($tmpStyle == AxisLabelStyle::$VALUE{
  1115.                 return $this->maxLabelsValueWidth();
  1116.             else
  1117.             if ($tmpStyle == AxisLabelStyle::$MARK{
  1118.                 return $this->chart->maxMarkWidth();
  1119.             else
  1120.             if ($tmpStyle == AxisLabelStyle::$TEXT{
  1121.                 return $this->chart->maxTextWidth();
  1122.             else {
  1123.                 return 0;
  1124.             }
  1125.  
  1126.         else {
  1127.             $result 0;
  1128.             $g=$this->chart->getGraphics3D();
  1129.             $items $this->getLabels()->getItems();
  1130.             for ($t 0$t sizeof($items)$t++{
  1131.                 $g->setFont($items->getItem($t)->getFont());
  1132.                 $result max($result,
  1133.                     $this->chart->multiLineTextWidth($items->getItem($t)->getText())->width);
  1134.             }
  1135.             return $result;
  1136.         }
  1137.     }
  1138.  
  1139.     private function internalCalcSize($tmpFont$tmpAngle$tmpText$tmpSize{
  1140.         if ($tmpSize != 0{
  1141.             return $tmpSize;
  1142.         else {
  1143.             $g $this->chart->getGraphics3D();
  1144.             if ($this->horizontal{
  1145.                 switch ($tmpAngle{
  1146.                 case 0:
  1147.                 case 180:
  1148.                     return $g->fontTextHeight($tmpFont);
  1149.                 default// optimized for speed
  1150.                     if (strlen($tmpText== 0{
  1151.                         $g->setFont($tmpFont);
  1152.                         return $this->maxLabelsWidth();
  1153.                     else {
  1154.                         return $g->textWidth($tmpText,$tmpFont);
  1155.                     }
  1156.                 }
  1157.             else {
  1158.                 switch ($tmpAngle{
  1159.                 case 90:
  1160.                 case 270:
  1161.                     return $g->fontTextHeight($tmpFont);
  1162.                 default// optimized for speed
  1163.                     if (strlen($tmpText== 0{
  1164.                         $g->setFont($tmpFont);
  1165.                         return $this->maxLabelsWidth();
  1166.                     else {
  1167.                         return $g->textWidth($tmpText,$tmpFont);
  1168.                     }
  1169.                 }
  1170.             }
  1171.         }
  1172.     }
  1173.  
  1174.     public function getSizeLabels({
  1175.         $result=$this->internalCalcSize($this->labels->getFont()$this->labels->getAngle()"",
  1176.                                 $this->labels->getCustomSize());
  1177.         if ($this->labels->getAlternate())
  1178.             $result=$result*2;
  1179.         return $result;
  1180.     }
  1181.  
  1182.     private function internalCalcDepthPosValue($value{
  1183.         if ($this->iRangezero{
  1184.             return $this->iCenterPos;
  1185.         else {
  1186.             return ($this->iAxisSizeRange *
  1187.                           ($this->inverted ? $this->iMaximum - $value :
  1188.                            $value $this->iMinimum));
  1189.         }
  1190.     }
  1191.  
  1192.     private function internalCalcLogPosValue($isx$value{
  1193.         if ($this->iRangelog == 0{
  1194.             return $this->iCenterPos;
  1195.         else
  1196.         if ($value <= 0{
  1197.             return (($isx && $this->inverted|| (!$isx && !$this->inverted)) ?
  1198.                     $this->iEndPos : $this->iStartPos;
  1199.         else {
  1200.             $tmpResult MathUtils::round($this->inverted ?
  1201.                                               (($this->iLogMax - log($value)) *
  1202.                                                $this->iAxisLogSizeRange)
  1203.                                               :
  1204.                                               (log($value$this->iLogMin*
  1205.                                               $this->iAxisLogSizeRange);
  1206.  
  1207.             return $isx $this->iStartPos + $tmpResult :
  1208.                     $this->iEndPos - $tmpResult;
  1209.         }
  1210.     }
  1211.  
  1212.     /**
  1213.      * Returns the corresponding $value of a Screen position in pixels.
  1214.      *
  1215.      * @param $value Screen $value
  1216.      * @return Position on screen in pixels
  1217.      */
  1218.     public function calcPosValue($value{
  1219.         return $this->horizontal ? $this->calcXPosValue($value$this->calcYPosValue($value);
  1220.     }
  1221.  
  1222.     /**
  1223.     * Description Calculates the Horizontal coordinate in pixels of $value parameter
  1224.      * You can use CalcXPos$value when requiring pixel positions from which
  1225.      * to plot Drawing output.
  1226.     * @param double $value 
  1227.     * @return int 
  1228.     */
  1229.  
  1230.     public function calcXPosValue($value{
  1231.         if ($this->isDepthAxis{
  1232.             return $this->internalCalcDepthPosValue($value);
  1233.         else
  1234.         if ($this->logarithmic{
  1235.             return $this->internalCalcLogPosValue(true$value);
  1236.         else
  1237.         if ($this->iRangezero{
  1238.             return $this->iCenterPos;
  1239.         else {
  1240.             $tmp ($value $this->iMinimum$this->iAxisSizeRange;
  1241.             $tmp $this->inverted ? $this->iEndPos - $tmp $this->iStartPos + $tmp;
  1242.             if ($tmp self::$MAXPIXELPOS{
  1243.                 $tmp self::$MAXPIXELPOS;
  1244.             else
  1245.             if ($tmp < -self::$MAXPIXELPOS{
  1246.                 $tmp = -self::$MAXPIXELPOS;
  1247.             }
  1248.             return $tmp;
  1249.         }
  1250.     }
  1251.  
  1252.     /**
  1253.      * Calculates the Vertical coordinate in pixels of $value parameter.
  1254.      *
  1255.      * @param $value $value Parameter
  1256.      * @return $Vertical coordinate in pixels
  1257.      */
  1258.     public function calcYPosvalue($value{
  1259.         if ($this->isDepthAxis{
  1260.             return $this->internalCalcDepthPosValue($value);
  1261.         else
  1262.         if ($this->logarithmic{
  1263.             return $this->internalCalcLogPosValue(false$value);
  1264.         else
  1265.         if ($this->iRangezero{
  1266.             return $this->iCenterPos;
  1267.         else {
  1268.  
  1269.             // compile with //#define CHECKOVER
  1270.             // if you wish to afunction axis coordinates overflow when zooming,
  1271.             // specially in Windows 95, 98 or Me.
  1272.  
  1273. //#if CHECKOVER
  1274.             $tmp ($value $this->iMinimum$this->iAxisSizeRange;
  1275.             $tmp $this->inverted ? $this->iStartPos + $tmp $this->iEndPos - $tmp;
  1276.             if ($tmp self::$MAXPIXELPOS{
  1277.                 $tmp self::$MAXPIXELPOS;
  1278.             else
  1279.             if ($tmp < -self::$MAXPIXELPOS{
  1280.                 $tmp = -self::$MAXPIXELPOS;
  1281.             }
  1282.             return (int) $tmp;
  1283.  
  1284. //#else  // faster version (no checking)...
  1285.  
  1286. //            $tmp = (int) (($value - iMinimum) * iAxisSizeRange);
  1287. //            return inverted ? IStartPos + tmp : IEndPos - tmp;
  1288.  
  1289. //#endif
  1290.         }
  1291.     }
  1292.  
  1293.     public function calcZPos({
  1294.         $result $this->isDepthAxis ? $this->chart->getHeight(:
  1295.                      $this->chart->getAspect()->getWidth3D();
  1296.         return MathUtils::round($result $this->zPosition * 0.01)// 6.0
  1297.     }
  1298.  
  1299.     /**
  1300.      * Returns the amount in pixels that corresponds to a portion of the axis
  1301.      * of size "$value" in axis scales.
  1302.      *
  1303.      * @param $value double
  1304.      * @return $Potrtion of axis in pixels
  1305.      */
  1306.     public function calcSizeValue($value{
  1307.         if ($value 0{
  1308.             if ($this->logarithmic{
  1309.                 return ($this->iRangelog != 0?
  1310.                         MathUtils::round(log($value*
  1311.                                          $this->iAxisLogSizeRange0;
  1312.             else {
  1313.                 return ($this->iRange != 0?
  1314.                         MathUtils::round($value $this->iAxisSizeRange0;
  1315.             }
  1316.         else {
  1317.             return 0;
  1318.         }
  1319.     }
  1320.  
  1321.     private function internalCalcPos($a$b{
  1322.         return ((($this->horizontal&& ($this->inverted)) ||
  1323.                 ((!$this->horizontal&& (!$this->inverted))) $a $b;
  1324.     }
  1325.  
  1326.     /**
  1327.      * Returns the corresponding $value of a Screen position.
  1328.      *
  1329.      * @param $value $Screen $value
  1330.      * @return double Position on screen in pixels
  1331.      */
  1332.     public function calcPosPoint($value{
  1333.  
  1334.         if ($this->logarithmic{
  1335.             if ($value == $this->iStartPos{
  1336.                 return $this->internalCalcPos($this->iMaximum$this->iMinimum);
  1337.             else if ($value == iEndPos{
  1338.                 return $this->internalCalcPos($this->iMinimum$this->iMaximum);
  1339.             else {
  1340.                 $tmp $this->iRangelog;
  1341.                 if ($tmp == 0{
  1342.                     return $this->iMinimum;
  1343.                 else {
  1344.                     if ($this->inverted{
  1345.                         $tmp (($this->iEndPos - $value$tmp $this->iAxisSize);
  1346.                     else {
  1347.                         $tmp (($value $this->iStartPos$tmp $this->iAxisSize);
  1348.                     }
  1349.  
  1350.                     return MathUtils::exp($this->horizontal ? $this->iLogMin + $tmp :
  1351.                                     $this->iLogMax - $tmp);
  1352.                 }
  1353.             }
  1354.         else
  1355.         if ($this->iAxisSize > 0{
  1356.  
  1357.             $tmp $this->inverted ? $this->iEndPos - $value $value $this->iStartPos;
  1358.             $tmp *= $this->iRange / $this->iAxisSize;
  1359.             return $this->horizontal ? $this->iMinimum + $tmp $this->iMaximum - $tmp;
  1360.  
  1361.         else {
  1362.             return 0;
  1363.         }
  1364.     }
  1365.  
  1366.     private function axisRect({
  1367.         $tmpPos1=0;
  1368.         $pos1=0;
  1369.         $tmpPos2=0;
  1370.         $pos2=0;
  1371.  
  1372.         if ($this->iStartPos > $this->iEndPos{
  1373.             $tmpPos1 $this->iEndPos;
  1374.             $tmpPos2 $this->iStartPos;
  1375.         else {
  1376.             $tmpPos1 $this->iStartPos;
  1377.             $tmpPos2 $this->iEndPos;
  1378.         }
  1379.  
  1380.         if ($this->posAxis > $this->labels->position{
  1381.             $pos1 $this->labels->position;
  1382.             $pos2 $this->posAxis + self::$AXISCLICKGAP;
  1383.         else {
  1384.             $pos1 $this->posAxis - self::$AXISCLICKGAP;
  1385.             $pos2 $this->labels->position;
  1386.         }
  1387.  
  1388.         if ($this->horizontal{
  1389.             return Rectangle::fromLTRB($tmpPos1$pos1$tmpPos2$pos2);
  1390.         else {
  1391.             return Rectangle::fromLTRB($pos1$tmpPos1$pos2$tmpPos2);
  1392.         }
  1393.     }
  1394.  
  1395.     /**
  1396.      * Returns if X and Y coordinates are close to the Axis position.
  1397.      *
  1398.      * @param xy Po$(X and Y coordinates)
  1399.      * @return boolean - X and Y coordinates as integer
  1400.      */
  1401. /*    public function clicked($xy) {
  1402.         return $this->clicked($xy->x, $xy->y);
  1403.     }
  1404.   */
  1405.     /**
  1406.      * Returns if X and Y coordinates are close to the Axis position.
  1407.      *
  1408.      * @param Pixel location
  1409.      * @param Pixel location
  1410.      * @return boolean - true if X and Y coordinates are
  1411.      *  on or near to Axis
  1412.      * @see Axes
  1413.      */
  1414.     public function clicked($x$y{
  1415.         return $this->chart->isAxisVisible($this&& $this->axisRect()->contains($x$y);
  1416.     }
  1417.  
  1418.     /**
  1419.      * Returns the calculated Maximum Horizontal $value for the specified AAxis.
  1420.      * <br>
  1421.      * AAxis can be Axis.Top or Axis.Bottom. Calculated means that the return
  1422.      * $value will be the Maximum $value of the Maximum Series X $values.
  1423.      * Only Series with the HorizontalAxis equal to AAxis will be considered.
  1424.      *
  1425.      * @return double 
  1426.      * @see Axes
  1427.      * @see Axis#getMinX$value
  1428.      * @see Axis#getMinY$value
  1429.      * @see Axis#getMaxY$value
  1430.      */
  1431.     public function getMaxXValue({
  1432.         return $this->chart->getMaxXValue($this);
  1433.     }
  1434.  
  1435.     /**
  1436.      * Returns the calculated Maximum Vertical $value for the specified AAxis.
  1437.      * <br>
  1438.      * AAxis can be Axis.Left or Axis.Right. Calculated means that the return
  1439.      * $value will be the Maximum $value of the Maximum Series Y $values. Only
  1440.      * Series with the VerticalAxis equal to AAxis will be considered.
  1441.      *
  1442.      * @return double 
  1443.      * @see Axes
  1444.      * @see Axis#getMinX$value
  1445.      * @see Axis#getMaxX$value
  1446.      * @see Axis#getMinY$value
  1447.      */
  1448.     public function getMaxYValue({
  1449.         return $this->chart->getMaxYValue($this);
  1450.     }
  1451.  
  1452.     /**
  1453.      * Returns the calculated Minimum Horizontal $value for the specified AAxis.
  1454.      * <br>
  1455.      * AAxis can be Axis.Top or Axis.Bottom. Calculated means that the return
  1456.      * $value will the Minimum $value of the Minimum Series X $values. Only
  1457.      * Series with the HorizontalAxis equal to AAxis will be considered.
  1458.      *
  1459.      * @return double 
  1460.      * @see Axes
  1461.      * @see Axis#getMaxX$value
  1462.      * @see Axis#getMinY$value
  1463.      * @see Axis#getMaxY$value
  1464.      */
  1465.     public function getMinXValue({
  1466.         return $this->chart->getMinXValue($this);
  1467.     }
  1468.  
  1469.     /**
  1470.      * Returns the calculted Minimum Vertical $value for the specified AAxis.
  1471.      * <br>
  1472.      * AAxis can be Axis.Left or Axis.Right. Calculated means that the return
  1473.      * $value will the Minimum $value of the Minimum Series Y $values. Only
  1474.      * Series with the VerticalAxis equal to AAxis will be considered.
  1475.      *
  1476.      * @return double 
  1477.      * @see Axes
  1478.      * @see Axis#getMinX$value
  1479.      * @see Axis#getMaxX$value
  1480.      * @see Axis#getMaxY$value
  1481.      */
  1482.     public function getMinYValue({
  1483.         return $this->chart->getMinYValue($this);
  1484.     }
  1485.  
  1486.     /**
  1487.      * Returns either a Time or Date format depending if the astep parameter
  1488.      * is lower than one day (time) or greater (date).
  1489.      *
  1490.      * @param astep double
  1491.      * @return DateFormat 
  1492.      */
  1493.     public function dateTimeDefaultFormat($astep{
  1494.         return ($astep <= 1?
  1495.                 "d/m/y" "d/m/y";
  1496.     }
  1497.  
  1498.     private function nextStep($oldStep{
  1499.         if ($oldStep >= 10{
  1500.             return 10 $this->nextStep(0.1 $oldStep);
  1501.         else if ($oldStep 1{
  1502.             return 0.1 $this->nextStep($oldStep 10);
  1503.         else if ($oldStep 2{
  1504.             return 2;
  1505.         else if ($oldStep 5{
  1506.             return 5;
  1507.         else {
  1508.             return 10;
  1509.         }
  1510.     }
  1511.  
  1512.     // returns AxisLabelStyle
  1513.     private function internalCalcLabelStyle({
  1514.         $tmpResult AxisLabelStyle::$NONE;
  1515.  
  1516.         if ($this->isDepthAxis{
  1517.             $tmpResult AxisLabelStyle::$TEXT;
  1518.             for ($t 0$t $this->chart->getSeriesCount()$t++{
  1519.                 $s $this->chart->getSeries($t);
  1520.                 if ($s->getActive()) {
  1521.                     if ($s->getHasZValues(||
  1522.                         ($s->getMinZValue(!= $s->getMaxZValue())) {
  1523.                         return AxisLabelStyle::$VALUE;
  1524.                     }
  1525.                 }
  1526.             }
  1527.         else {
  1528.             for ($t 0$t $this->chart->getSeriesCount()$t++{
  1529.                 $tmpSeries $this->chart->getSeries($t);
  1530.  
  1531.                 if (($tmpSeries->getActive()) &&
  1532.                     ($tmpSeries->associatedToAxis($this))) {
  1533.  
  1534.                     $tmpResult AxisLabelStyle::$VALUE;
  1535.                     if ((($this->horizontal&& ($tmpSeries->getYMandatory())) ||
  1536.                         ((!$this->horizontal&& (!$tmpSeries->getYMandatory()))) {
  1537.                         if (($tmpSeries->getLabels(!= null&&
  1538.                             (strlen($tmpSeries->getLabels[0]!= 0)) {
  1539.                             return AxisLabelStyle::$TEXT;
  1540.                         }
  1541.                     }
  1542.                 }
  1543.             }
  1544.         }
  1545.         return $tmpResult;
  1546.     }
  1547.  
  1548.     private function internalCalcLabelsIncrement($maxNumLabels{
  1549.  
  1550.         if ($this->desiredIncrement <= 0{
  1551.             if ($this->iRange == 0{
  1552.                 $tmpResult 1;
  1553.             else {
  1554.                 $tmpResult abs($this->iRange($maxNumLabels 1);
  1555.                 if ($this->anySeriesHasLessThan($maxNumLabels)) {
  1556.                     $tmpResult max(1$tmpResult);
  1557.                 }
  1558.             }
  1559.         else {
  1560.             $tmpResult $this->desiredIncrement;
  1561.         }
  1562.  
  1563.         $tempNumLabels $maxNumLabels 1;
  1564.  
  1565.         $inf false;
  1566.  
  1567.         if (is_Infinite($this->iRange)) {
  1568.             return 1;
  1569.         }
  1570.  
  1571.         if ($this->labels->getSeparation(>= 0{
  1572.  
  1573.             do {
  1574.                 $tmp $this->iRange / $tmpResult;
  1575.                 if (abs($tmpintval('1000000000000')) {   // Int MAX_VALUE
  1576.                     $tempNumLabels (MathUtils::round($tmp));
  1577.                     if ($tempNumLabels $maxNumLabels{
  1578.                         $tmpResult $this->nextStep($tmpResult);
  1579.                     }
  1580.                 else {
  1581.                     $tmpResult $this->nextStep($tmpResult);
  1582.                 }
  1583.                 $inf is_Infinite($tmpResult);
  1584.  
  1585.             while (($tempNumLabels $maxNumLabels&&
  1586.                      ($tmpResult <= $this->iRange&& (!$inf));
  1587.         }
  1588.         return $inf $this->iRange : max($tmpResult$this->iMinAxisIncrement);
  1589.     }
  1590.  
  1591.     static private function nextDateTimeStep($aStep{
  1592.         $tmpDateTimeStep new DateTimeStep();
  1593.  
  1594.         for ($t DateTimeStep::$ONEYEAR 1;
  1595.              $t >= DateTimeStep::$ONEMILLISECOND$t--{
  1596.             if ($aStep >= ($tmpDateTimeStep->STEP[$t])) {
  1597.                 return $tmpDateTimeStep->STEP[$t 1];
  1598.             }
  1599.         }
  1600.         return $tmpDateTimeStep->STEP[DateTimeStep::$ONEYEAR];
  1601.     }
  1602.  
  1603.  
  1604.     private function calcDateTimeIncrement($maxNumLabels{
  1605.  
  1606.         $tmpDateTimeStep new DateTimeStep();
  1607.         $tmpResult max($this->desiredIncrement,
  1608.                                     $tmpDateTimeStep->STEP[
  1609.                                     DateTimeStep::$ONEMILLISECOND]);
  1610.  
  1611.         if (($tmpResult 0&& ($maxNumLabels 0)) {
  1612.             if (($this->iRange / $tmpResult1000000{
  1613.                 $tmpResult $this->iRange / 1000000;
  1614.             }
  1615.  
  1616.             do {
  1617.                 $tempNumLabels MathUtils::round($this->iRange / $tmpResult);
  1618.                 if ($tempNumLabels $maxNumLabels{
  1619.                     if ($tmpResult $tmpDateTimeStep->STEP[
  1620.                         DateTimeStep::$ONEYEAR]{
  1621.                         $tmpResult self::nextDateTimeStep($tmpResult);
  1622.                     else {
  1623.                         $tmpResult *= 2;
  1624.                     }
  1625.                 }
  1626.             while ($tempNumLabels $maxNumLabels);
  1627.         }
  1628.  
  1629.         return max($tmpResult$tmpDateTimeStep->STEP[DateTimeStep::$ONEMILLISECOND]);
  1630.     }
  1631.  
  1632.     private function anySeriesHasLessThan($num{
  1633.         $result false;
  1634.         for ($t 0$t $this->chart->getSeriesCount()$t++{
  1635.             $s $this->chart->getSeries($t);
  1636.             if ($s->getActive()) {
  1637.                 if (($s->getYMandatory(&& $this->getHorizontal()) ||
  1638.                     ((!$s->getYMandatory()) && (!$this->getHorizontal()))) {
  1639.                     if ($s->associatedToAxis($this)) {
  1640.                         $result $s->getCount(<= $num;
  1641.                         if ($result{
  1642.                             break;
  1643.                         }
  1644.                     }
  1645.                 }
  1646.             }
  1647.         }
  1648.         return $result;
  1649.     }
  1650.  
  1651.     private function calcLabelsIncrement($maxNumLabels{
  1652.  
  1653.     if ($maxNumLabels 0{
  1654.             if ($this->iAxisDateTime{
  1655.                 $tmpResult $this->calcDateTimeIncrement($maxNumLabels);
  1656.             else {
  1657.                 $tmpResult $this->internalCalcLabelsIncrement($maxNumLabels);
  1658.             }
  1659.         else {
  1660.             if ($this->iAxisDateTime{
  1661.                 $tmpDateTimeStep new DateTimeStep();
  1662.                 $tmpResult $tmpDateTimeStep->STEP[DateTimeStep::$ONEMILLISECOND];
  1663.             else {
  1664.                 $tmpResult $this->iMinAxisIncrement;
  1665.             }
  1666.         }
  1667.         return $tmpResult;
  1668.     }
  1669.  
  1670.     /**
  1671.      * Returns the calculated Axis Label increment.
  1672.      *
  1673.      * @param maxLabelSize $The maximum allowable LabelSize in pixels.
  1674.      * @return double Size of increment in Axis units.
  1675.      */
  1676.     public function calcXYIncrement($maxLabelSize{
  1677.         if ($maxLabelSize 0{
  1678.             if ($this->labels->getSeparation(0{
  1679.                 $maxLabelSize ($maxLabelSize +
  1680.                                       MathUtils::round(0.01 *
  1681.                                                  $this->labels->getSeparation(*
  1682.                                                  $maxLabelSize));
  1683.             }
  1684.             $tmp (MathUtils::round((1.0 $this->iAxisSize/
  1685.                                     $maxLabelSize));
  1686.         else {
  1687.             $tmp 1;
  1688.         }
  1689.         return $this->calcLabelsIncrement($tmp);
  1690.     }
  1691.  
  1692.     /**
  1693.      * Returns the calculated Axis Label increment and serves as a useable
  1694.      * measure when Labelling is set to manual or automatic increments.<br>
  1695.      * Please note that the related Increment property only returns the
  1696.      * increment $value when those increments are manually set via the same
  1697.      * property.
  1698.      *
  1699.      * @return double calculated Axis Label increment.
  1700.      */
  1701.     public function getCalcIncrement({
  1702.  
  1703.         if ($this->horizontal{
  1704.             $tmp max($this->labels->labelWidth($this->iMinimum),
  1705.                            $this->labels->labelWidth($this->iMaximum));
  1706.         else {
  1707.             $tmp max($this->labels->labelHeight($this->iMinimum),
  1708.                            $this->labels->labelHeight($this->iMaximum));
  1709.         }
  1710.  
  1711.         $result=$this->calcXYIncrement($tmp);
  1712.  
  1713.         if ($this->labels->getAlternate())
  1714.             if ($this->getLogarithmic())
  1715.                 $result=$result/$this->logarithmicBase;
  1716.             else
  1717.                 $result=$result/2;
  1718.  
  1719.         return $result;
  1720.     }
  1721.  
  1722.     /**
  1723.      *
  1724.      *
  1725.      * @return int 
  1726.      */
  1727.     public function getSizeTickAxis({
  1728.         $tmpResult 0;
  1729.         if ($this->getVisible()) {
  1730.             $tmpResult $this->axispen->getWidth(1;
  1731.         }
  1732.  
  1733.         if ($this->getTicks()->getVisible()) {
  1734.             $tmpResult += $this->ticks->length;
  1735.         }
  1736.         if ($this->getMinorTicks()->getVisible()) {
  1737.             $tmpResult max($tmpResult$this->minorTicks->length);
  1738.         }
  1739.         return $tmpResult;
  1740.     }
  1741.  
  1742.     function getRectangleEdge($r{
  1743.         if ($this->otherSide{
  1744.             return $this->horizontal ? $r->$r->getRight();
  1745.         else {
  1746.             return $this->horizontal ? $r->getBottom($r->x;
  1747.         }
  1748.     }
  1749.  
  1750.     private function inflateAxisRect($value$r{
  1751.         $tmpL $r->x;
  1752.         $tmpT $r->y;
  1753.         $tmpR $r->getRight();
  1754.         $tmpB $r->getBottom();
  1755.         if ($this->horizontal{
  1756.             if ($this->otherSide{
  1757.                 $tmpT += $value;
  1758.             else {
  1759.                 $tmpB -= $value;
  1760.             }
  1761.         else
  1762.         if ($this->otherSide{
  1763.             $tmpR -= $value;
  1764.         else {
  1765.             $tmpL += $value;
  1766.         }
  1767.  
  1768.         $r->$tmpL;
  1769.         $r->$tmpT;
  1770.         $r->width $tmpR $tmpL;
  1771.         $r->height $tmpB $tmpT;
  1772.         return $r;
  1773.     }
  1774.  
  1775.     private function inflateAxisPos($value$amount{
  1776.         $tmpResult $value;
  1777.         if ($this->horizontal{
  1778.             if ($this->otherSide{
  1779.                 $tmpResult -= $amount;
  1780.             else {
  1781.                 $tmpResult += $amount;
  1782.             }
  1783.         else {
  1784.             if ($this->otherSide{
  1785.                 $tmpResult += $amount;
  1786.             else {
  1787.                 $tmpResult -= $amount;
  1788.             }
  1789.         }
  1790.         return $tmpResult;
  1791.     }
  1792.  
  1793.     // returns CalcLabelsResults
  1794.     private function calcLabelsRect($tmpSize$r{
  1795.         $result new CalcLabelsResults();
  1796.         $result->rect $this->inflateAxisRect($tmpSize$r);
  1797.         $result->position $this->getRectangleEdge($result->rect);
  1798.         return $result;
  1799.     }
  1800.  
  1801.     /**
  1802.      * Used internally by Chart when creating Axes
  1803.      *
  1804.      * @param Chart Rectangle
  1805.      * @param inflateChartRectangle boolean Wall allowance (standard Axes only)
  1806.      * @return Rectangle 
  1807.      */
  1808.     public function calcRect($r$inflateChartRectangle{
  1809.         $this->iAxisDateTime = $this->isDateTime();
  1810.  
  1811.         if ($inflateChartRectangle{
  1812.             // new? todo  CalcLabelsResults tmpRes;
  1813.  
  1814.             if ($this->isDepthAxis{
  1815.                 if ($this->otherSide{
  1816.                     $this->posTitle = $r->getRight();
  1817.                 else {
  1818.                     $this->posTitle = $r->getLeft();
  1819.                 }
  1820.             else {
  1821.                 if (($this->axisTitle != null&& $this->axisTitle->getVisible(&&
  1822.                     (strlen($this->axisTitle->getCaption()) != 0)) {
  1823.  
  1824.                     $tmpRes $this->calcLabelsRect($this->internalCalcSize(
  1825.                             $this->axisTitle->getFont()$this->axisTitle->getAngle(),
  1826.                             $this->axisTitle->getCaption()$this->axisTitle->getCustomSize()),
  1827.                                             $r);
  1828.  
  1829.                     $this->posTitle = $tmpRes->position;
  1830.                 }
  1831.             }
  1832.  
  1833.             if ($this->labels->getVisible()) {
  1834.                 $tmpRes $this->calcLabelsRect($this->getSizeLabels()+10$r);  // Rev aded +10
  1835.                 $this->labels->position $tmpRes->position;
  1836.             }
  1837.  
  1838.  
  1839.             $tmp $this->getSizeTickAxis($this->chart->getWalls()->calcWallSize($this);
  1840.             if ($tmp 0{
  1841.                 $r $this->inflateAxisRect($tmp$r);
  1842.             }
  1843.             $this->posTitle = $this->applyPosition($this->posTitle$r);
  1844.             $this->labels->position $this->applyPosition($this->labels->position$r);
  1845.         else {
  1846.             $this->posAxis = $this->applyPosition($this->getRectangleEdge($r)$r);
  1847.             $this->labels->position $this->inflateAxisPos($this->posAxis$this->getSizeTickAxis());
  1848.             $this->posTitle = $this->inflateAxisPos($this->labels->position$this->getSizeLabels());
  1849.         }
  1850.  
  1851.         return $r;
  1852.     }
  1853.  
  1854.     function applyPosition($apos$r{
  1855.  
  1856.         if ($this->relativePosition != 0{
  1857.             if ($this->positionUnits == PositionUnits::$PERCENT{
  1858.                 $tmpsize $this->horizontal ? $r->height $r->width;
  1859.                 $tmpsize MathUtils::round(0.01 $this->relativePosition *
  1860.                                            $tmpsize);
  1861.             else {
  1862.                 $tmpsize MathUtils::round($this->relativePosition)// pixels
  1863.             }
  1864.  
  1865.             if ($this->otherSide{
  1866.                 $tmpsize = -$tmpsize;
  1867.             }
  1868.             if ($this->horizontal{
  1869.                 $tmpsize = -$tmpsize;
  1870.             }
  1871.  
  1872.             return $apos $tmpsize;
  1873.         else {
  1874.             return $apos;
  1875.         }
  1876.     }
  1877.  
  1878.     /**
  1879.      * Used internally to return Axis Datetime step.
  1880.      *
  1881.      * @param step$value double Desired increment
  1882.      * @return int 
  1883.      */
  1884.     static public function findDateTimeStep($stepValue{
  1885.         $tmpDateTimeStep new DateTimeStep();
  1886.         for ($t DateTimeStep::$ONEYEAR 1;
  1887.                      $t >= DateTimeStep::$ONEMILLISECOND$t--{
  1888.             if ((abs($tmpDateTimeStep->STEP[$t$stepValue)) <
  1889.                 ($tmpDateTimeStep->STEP[DateTimeStep::$ONEMILLISECOND])) {
  1890.                 return $t;
  1891.             }
  1892.         }
  1893.         return DateTimeStep::$NONE;
  1894.     }
  1895.  
  1896.     // returns String
  1897.     private function drawExponentLabel($x$y$tmpZ$tmpSt2{
  1898.         $g $this->chart->getGraphics3D();
  1899.         $i $tmpSt2->toUpperCase()->indexOf('E');
  1900.         if ($i == -1{
  1901.             $g->textOut($x$y$tmpZ$tmpSt2);
  1902.         else {
  1903.             //CDI TTrack //#1525
  1904.             $tmp "";
  1905.             $tmpSub "";
  1906.             if (($i 10{
  1907.                 $tmp $tmpSt2->substring(01);
  1908.                 $tmpSub $tmpSt2->substring(1);
  1909.             else {
  1910.                 $tmp $tmpSt2->substring(0$i 1);
  1911.                 $tmpSub $tmpSt2->substring($i 1);
  1912.             }
  1913.  
  1914.             $font $g->getFont();
  1915.             $oldSize $font->getSize();
  1916.             $tmpH $oldSize 1;
  1917.  
  1918.             if (in_array(StringAlignment::$NEAR,$g->getTextAlign())) {
  1919.                 $g->textOut($x$y$tmpZ$tmp);
  1920.                 $tmpW $g->textWidth($tmp1;
  1921.                 $font->setSize($font->getSize(($oldSize 0.25));
  1922.                 $g->textOut( ($x $tmpW),
  1923.                            ($y ($tmpH 0.5)) 2$tmpZ,
  1924.                           $tmpSub);
  1925.                 $font->setSize($oldSize);
  1926.             else {
  1927.                 $font->setSize($font->getSize(-
  1928.                                      ($oldSize 0.25));
  1929.                 $g->textOut($x$y ($tmpH 0.52$tmpZ,
  1930.                           $tmpSub);
  1931.                 $tmpW $g->textWidth($tmpSub1;
  1932.                 $font->setSize($oldSize);
  1933.                 $g->textOut(($x $tmpW)$y$tmpZ$tmp);
  1934.             }
  1935.         }
  1936.         return $tmpSt2;
  1937.     }
  1938.  
  1939.     static private function numTextLines($st{
  1940. // TODO         $i = $st->indexOf(Language::getString("LineSeparator"));
  1941. // Temporary -1
  1942.         $i=-1;
  1943.  
  1944.         if ($i == -1{
  1945.             return 1;
  1946.         else {
  1947.             $tmpResult 0;
  1948.             while ($i != -1{
  1949.                 $tmpResult++;
  1950.                 $st $st->substring($i 1);
  1951.                 $i $st->indexOf(Language::getString("LineSeparator"));
  1952.             }
  1953.             if ($st->length(!= 0{
  1954.                 $tmpResult++;
  1955.             }
  1956.             return $tmpResult;
  1957.         }
  1958.     }
  1959.  
  1960.     /**
  1961.      * Draws Axis Label (String) at specified X,Y co-ordinate at Angle.
  1962.      *
  1963.      * @param $x coordinate
  1964.      * @param $y coordinate
  1965.      * @param angle $Angle at which Label is drawn
  1966.      * @param st String asociated to Label
  1967.      * @param labelItem TextShape
  1968.      */
  1969.     public function _drawAxisLabel($x$y$angle$st$labelItem{
  1970.         $this->drawAxisLabel($this->labels->getFont()$x$y$angle$st$labelItem);
  1971.     }
  1972.  
  1973.     /**
  1974.      * Draws Axis Label (String) in font f at specified X,Y co-ordinate at
  1975.      * Angle.
  1976.      *
  1977.      * @param ChartFont
  1978.      * @param $x coordinate
  1979.      * @param $y coordinate
  1980.      * @param angle $Angle at which Label is drawn
  1981.      * @param st String asociated to Label
  1982.      * @param format TextShape
  1983.      */
  1984.     public function drawAxisLabel($f$x$y$angle$st$format{
  1985.         $old_name TChart::$controlName;
  1986.         TChart::$controlName .='AxisLabel';
  1987.         
  1988.         // TODO
  1989.         /*StringAlignment[][] aligns =
  1990.                 new StringAlignment[][] { {StringAlignment.FAR,
  1991.                 StringAlignment.NEAR}, {StringAlignment.CENTER,
  1992.                 StringAlignment.CENTER}
  1993.         };
  1994.  
  1995.         StringAlignment tmpAlign, tmpAlign2;
  1996.         */
  1997.         $g $this->chart->getGraphics3D();
  1998.  
  1999.         $oldStrAlign $g->getTextAlign();
  2000.  
  2001.         if ($format == null{
  2002.             $format $this->getLabels();
  2003.         else {
  2004.             $f $format->getFont();
  2005.         }
  2006.  
  2007.         $g->setFont($f);
  2008.  
  2009.         $tmpFontH $g->getFontHeight();
  2010.  
  2011.         $tmpH $tmpFontH 2;
  2012.  
  2013.         $intHorizontal $this->horizontal ? 0;
  2014.         $intOtherSide $this->otherSide 0;
  2015.         $notIntOtherSide $this->otherSide 1;
  2016.  
  2017.         $tmpZ $this->iZPos;
  2018.  
  2019.         $n self::numTextLines($st);
  2020.         $delta $tmpFontH;
  2021.         $textWidth $g->textWidth($st);
  2022.  
  2023.         if ($this->horizontal && $this->otherSide{
  2024.             if (($angle 90&& ($angle <= 180)) {
  2025. //                $y += $delta; //1st line
  2026.                 $y += ($delta ($n2);
  2027.                 $x += ($textWidth);
  2028.                 $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2029.                                   StringAlignment::$VERTICAL_CENTER_ALIGN);
  2030.             else if (($angle 0&& ($angle 90)) {
  2031.                 $x -= ($delta ($n2);
  2032.                 $x -= (($delta2);
  2033.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2034.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2035.                                       StringAlignment::$VERTICAL_BOTTOM_ALIGN);
  2036.                 else {
  2037.                     $y -= $this->maxLabelsWidth();
  2038.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2039.                                 StringAlignment::$VERTICAL_TOP_ALIGN);
  2040.                 }
  2041.             else if ($angle == 90{
  2042.                 $x -= ($delta ($n2);
  2043.                 $x -= (($delta /2)/2);
  2044.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2045.                     $tmpAlign array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2046.                                       StringAlignment::$VERTICAL_BOTTOM_ALIGN);
  2047.                 else {
  2048.                     $y -= $this->maxLabelsWidth();
  2049.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2050.                                 StringAlignment::$VERTICAL_TOP_ALIGN);
  2051.                 }
  2052.             else if (($angle 180&& ($angle <= 270)) {
  2053.                 $x $x $delta ($delta ($n2);
  2054.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2055.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2056.                                       StringAlignment::$VERTICAL_TOP_ALIGN);
  2057.                 else {
  2058.                     $y -= $this->maxLabelsWidth();
  2059.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2060.                                       StringAlignment::$VERTICAL_BOTTOM_ALIGN);
  2061.                 }
  2062.             else {
  2063.                 $y -= $delta ($n 1);
  2064.                 $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2065.                                   StringAlignment::$VERTICAL_CENTER_ALIGN);
  2066.             }
  2067.         else if ($this->horizontal{
  2068.             if (($angle 90&& ($angle <= 180)) {
  2069.                 $y += $delta//1st line
  2070.                 $x += ($textWidth);
  2071.                 $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2072.                                   StringAlignment::$VERTICAL_CENTER_ALIGN);
  2073.             else if (($angle 0&& ($angle 90)) {
  2074.                 $x -= ($delta ($n2);
  2075.                 $x -= ($delta);
  2076.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2077.                     $y += $this->maxLabelsWidth();
  2078.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2079.                                       StringAlignment::$VERTICAL_CENTER_ALIGN);
  2080.                 else {
  2081.                     //$y += $this->maxLabelsWidth();
  2082.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2083.                                       StringAlignment::$VERTICAL_BOTTOM_ALIGN);
  2084.                 }
  2085.             else if ($angle == 90{
  2086.                 $x -= ($delta ($n2);
  2087.                 $x -= (($delta /2)/2);
  2088.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2089.                     $mlv $this->maxLabelsWidth();
  2090.                     $y += $mlv (0.10 $mlv);
  2091.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2092.                                       StringAlignment::$VERTICAL_BOTTOM_ALIGN);
  2093.                 else {
  2094.                     // $y -= $this->maxLabelsWidth();
  2095.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2096.                                       StringAlignment::$VERTICAL_TOP_ALIGN);
  2097.                 }
  2098.             else if (($angle 180&& ($angle <= 270)) {
  2099.                 $x += $delta ($delta ($n2);
  2100.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2101.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2102.                                       StringAlignment::$VERTICAL_TOP_ALIGN);
  2103.                 else {
  2104.                     $y += $this->maxLabelsWidth();
  2105.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2106.                                       StringAlignment::$VERTICAL_BOTTOM_ALIGN);
  2107.                 }
  2108.             else {
  2109.                 $y -= $delta;
  2110.                 $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2111.                                   StringAlignment::$VERTICAL_CENTER_ALIGN);
  2112.             }
  2113.         else if ($this->otherSide{
  2114.             if ((($angle 270&& ($angle <= 360)) || ($angle == 0)) {
  2115.                 $y -= $delta//1st line
  2116.                 $y -= ($delta ($n)) 2;
  2117.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2118.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_LEFT_ALIGN,
  2119.                                       StringAlignment::$VERTICAL_CENTER_ALIGN);
  2120.                 else {
  2121.                     $x += $this->maxLabelsWidth();
  2122.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_RIGHT_ALIGN,
  2123.                                       StringAlignment::$VERTICAL_CENTER_ALIGN);
  2124.                 }
  2125.             else if (($angle 90&& ($angle <= 180)) {
  2126.                 $y += 100+$delta//1st line
  2127.                 $y += ($delta ($n)) 2;
  2128.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2129.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_RIGHT_ALIGN,
  2130.                                       StringAlignment::$VERTICAL_CENTER_ALIGN);
  2131.                 else {
  2132.                     $x += $this->maxLabelsWidth();
  2133.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_LEFT_ALIGN,
  2134.                                       StringAlignment::$VERTICAL_CENTER_ALIGN);
  2135.                 }
  2136.             else if (($angle 0&& ($angle <= 90)) {
  2137.                 $x -= ($delta 2);
  2138.                 $y += ($delta ($n)) 2;
  2139.                 $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2140.                                   StringAlignment::$VERTICAL_CENTER_ALIGN);
  2141.             else {
  2142.                 $x += $delta ($n 1);
  2143.                 $y -= ($textWidth 2);
  2144.                 $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2145.                                   StringAlignment::$VERTICAL_CENTER_ALIGN);
  2146.             }
  2147.         else {
  2148.             if ((($angle 270&& ($angle <= 360)) || ($angle == 0)) {
  2149.                 $y -= $delta//1st line
  2150.                 $y -= ($delta ($n)) 2;
  2151.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2152.                     $x -= 2;
  2153.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_RIGHT_ALIGN,
  2154.                                       StringAlignment::$VERTICAL_CENTER_ALIGN);
  2155.                 else {
  2156.                     $x -= $this->maxLabelsWidth();
  2157.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_LEFT_ALIGN,
  2158.                                       StringAlignment::$VERTICAL_CENTER_ALIGN);
  2159.                 }
  2160.             else if (($angle 90&& ($angle <= 180)) {
  2161.                 $y += $delta//1st line
  2162.                 $y += ($delta ($n)) 2;
  2163.                 if ($this->getLabels()->getAlign(== AxisLabelAlign::$DEF{
  2164.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2165.                                       StringAlignment::$VERTICAL_CENTER_ALIGN);
  2166.                 else {
  2167.                     $x -= $this->maxLabelsWidth();
  2168.                     $tmpAlign Array(StringAlignment::$HORIZONTAL_RIGHT_ALIGN,
  2169.                                       StringAlignment::$VERTICAL_CENTER_ALIGN);
  2170.                 }
  2171.             else if (($angle 0&& ($angle 90)) {
  2172.                 $x -= $delta ($n+1);
  2173.                 $x += (($delta/2)/2);
  2174.                 $y += ($textWidth 2);
  2175.                 $tmpAlign Array(StringAlignment::$HORIZONTAL_RIGHT_ALIGN,
  2176.                                   StringAlignment::$VERTICAL_CENTER_ALIGN);
  2177.             else if ($angle==90{
  2178.                 $x -= $delta ($n+1;
  2179.                 $y += ($textWidth 22;
  2180.                 $tmpAlign Array(StringAlignment::$HORIZONTAL_RIGHT_ALIGN,
  2181.                                   StringAlignment::$VERTICAL_CENTER_ALIGN);
  2182.             else {
  2183.                 $x += $delta;
  2184.                 $tmpAlign Array(StringAlignment::$HORIZONTAL_CENTER_ALIGN,
  2185.                                   StringAlignment::$VERTICAL_CENTER_ALIGN);
  2186.             }
  2187.         }
  2188.  
  2189.         if (!$format->getTransparent()) {
  2190.             // TODO UPDATE THIS PART OF CODE FOR ALIGNMENT
  2191.             $tmpSize $g->textWidth("W"4//4 instead 2 so the margin don't be so high
  2192.  
  2193.             $format->setLeft($x);
  2194.             $format->setTop($y $delta);
  2195.  
  2196.             $tmp $this->chart->multiLineTextWidth($st);
  2197.             $tmpW $tmp->width;
  2198.             $tmpNum $tmp->count;
  2199.  
  2200.             $tmpH $tmpFontH $tmpNum;
  2201.  
  2202.             $tmpAlign2 $tmpAlign;
  2203.  
  2204.             $format->setBottom($format->getTop($tmpH);
  2205.             $format->setRight($format->getLeft($tmpW);
  2206.  
  2207.             if (in_array(StringAlignment::$FAR,$tmpAlign2)) {
  2208.                 $tmpW ($format->getRight($format->getLeft());
  2209.                 $format->setLeft($format->getLeft($tmpW);
  2210.                 $format->setRight($format->getLeft($tmpW);
  2211.  
  2212.             else if (in_array(StringAlignment::$CENTER,$tmpAlign2)) {
  2213.                 $tmpW ($format->getRight($format->getLeft()) 2;
  2214.                 $format->setLeft($format->getLeft($tmpW);
  2215.                 $format->setRight($format->getRight($tmpW);
  2216.             }
  2217.  
  2218.             $format->setLeft($format->getLeft($tmpSize);
  2219.             $format.setRight($format->getRight($tmpSize);
  2220.  
  2221.             if ($tmpZ != 0{
  2222.                 $format->setShapeBounds($g->calcRect3D($format->getShapeBounds(),
  2223.                         $tmpZ));
  2224.             }
  2225.  
  2226.             $format->drawRectRotated($g$format->getShapeBounds(),
  2227.                                    $this->getLabels()->getAngle()$tmpZ);
  2228.  
  2229.             $g->getBrush()->setVisible(false);
  2230.         }
  2231.  
  2232.         $g->setTextAlign($tmpAlign);
  2233.  
  2234.         $tmpD $delta $n;
  2235.  
  2236.         $tmpSt $st;
  2237.         $tmpSt2 "";
  2238.         $is3D $this->chart->getAspect()->getView3D();
  2239.         
  2240.         ++$this->labelIndex;
  2241.  
  2242.         for ($tt 1$tt <= $n$tt++{
  2243.             // TODO $i = $tmpSt->indexOf(Language.getString("LineSeparator"));
  2244.             // TODO remove temporary below line
  2245.             $i=-1;
  2246.  
  2247.             $tmpSt2 ($i != -1substr($tmpSt,0$i$tmpSt;
  2248.  
  2249.             if ($angle == 0{
  2250.                 $y += $delta;
  2251.                 $g->setFont($f);
  2252.                 if ($this->labels->getExponent()) {
  2253.                     $tmpSt2 $this->drawExponentLabel($x$y$tmpZ$tmpSt2);
  2254.                 else {
  2255.                   if ($is3D{
  2256.                     $g->textOut($x$y$tmpZ$tmpSt2);
  2257.                   }
  2258.                   else {
  2259.                     $g->textOut($x$y0$tmpSt2);
  2260.                   }
  2261.                 }
  2262.             else {
  2263.                 if (($angle >= 0&& ($angle <= 90)) {
  2264.                     $x += $delta;
  2265.                 else if (($angle 90&& ($angle <= 180)) {
  2266.                     $y -= $delta;
  2267.                 else if (($angle 180&& ($angle <= 270)) {
  2268.                     $x -= $delta;
  2269.                 else if (($angle 270&& ($angle 360)) {
  2270.                     $y += $delta;
  2271.                 }
  2272.  
  2273.                 $g->rotateLabel($x$y$tmpZ$tmpSt2$angle);
  2274.             }
  2275.  
  2276.             if ($i >= 0{
  2277.                 $tmpSt substr($tmpSt,0,$i 1);
  2278.             }
  2279.         }
  2280.  
  2281.         $g->setTextAlign($oldStrAlign);
  2282.         TChart::$controlName=$old_name;
  2283.     }
  2284.  
  2285.     protected function getDepthAxisAlign({
  2286.         if ($this->otherSide{
  2287.             return StringAlignment::$NEAR;
  2288.         else {
  2289.             return StringAlignment::$FAR;
  2290.         }
  2291.     }
  2292.  
  2293.     private function getDepthAxisPos({
  2294.         if ($this->otherSide{
  2295.             return $this->chart->getChartRect()->getBottom()->calcZPos();
  2296.         else {
  2297.             return $this->chart->getChartRect()->getTop()+$this->calcZPos();
  2298.         }
  2299.     }
  2300.  
  2301.     /**
  2302.      * TeeChart internal use. Outputs the title during the chart painting
  2303.      * procedure.
  2304.      *
  2305.      * @param $x coordinate
  2306.      * @param $y coordinate
  2307.      */
  2308.     public function drawTitle($x$y{
  2309.         $old_name TChart::$controlName;
  2310.         
  2311.         TChart::$controlName .='Axis_Title_';           
  2312.         
  2313.         if ($this->isDepthAxis{
  2314.             $g $this->chart->getGraphics3D();
  2315.             $g->setTextAlign($this->getDepthAxisAlign());
  2316.             $g->setFont($this->axisTitle->getFont());
  2317.             $g->textOut($x$y$this->chart->getAspect()->getWidth3D(2,
  2318.                       $this->axisTitle->getCaption());
  2319.         else {
  2320.             $old $this->labels->getExponent();
  2321.             $this->labels->setExponent(false);
  2322.             $this->drawAxisLabel($this->axisTitle->getFont()$x$y$this->axisTitle->getAngle(),
  2323.                           $this->axisTitle->getCaption()null);
  2324.             $this->labels->setExponent($old);
  2325.         }
  2326.         
  2327.         TChart::$controlName=$old_name;
  2328.     }
  2329.  
  2330.     private function _decMonths($howMany$date{
  2331.         return $this->decMonths($howMany$date->day$date->month$date->year);
  2332.     }
  2333.  
  2334.     private function decMonths($howMany$day$month$year{
  2335.         $day 1;
  2336.         if ($month $howMany{
  2337.             $month -= $howMany;
  2338.         else {
  2339.             $year--;
  2340.             $month 12 ($howMany $month);
  2341.         }
  2342.         return new DateParts($year$month$day);
  2343.     }
  2344.  
  2345.     private function /*DateParts*/ _incMonths($howMany/*DateParts*/ $date{
  2346.         return $this->incMonths($howMany$date->year$date->month$date->day);
  2347.     }
  2348.  
  2349.     private function /*DateParts*/ incMonths($howMany$day$month$year{
  2350.         $day 1;
  2351.         $month += $howMany;
  2352.         if ($month 12{
  2353.             $year++;
  2354.             $month -= 12;
  2355.         }
  2356.         return new DateParts($year$month$day);
  2357.     }
  2358.  
  2359.     /*protected*/ public function incDecDateTime($increment,
  2360.                                     $value,
  2361.                                     $anIncrement,
  2362.                                     $tmpWhichDatetime{
  2363.         return $this->dateTimeIncrement($this->labels->getExactDateTime(&&
  2364.                                  $this->iAxisDateTime &&
  2365.                                  ($tmpWhichDatetime >= DateTimeStep::$HALFMONTH),
  2366.                                  $increment$value$anIncrement,
  2367.                                  $tmpWhichDatetime);
  2368.     }
  2369.  
  2370.     private function incDecMonths($howMany/*DateParts*/ $date$increment{
  2371.         if ($increment{
  2372.             $this->incMonths($howMany$date);
  2373.         else {
  2374.             $this->decMonths($howMany$date);
  2375.         }
  2376.     }
  2377.  
  2378.     /**
  2379.      * Is a set of constants used to specify a date time increment.
  2380.      *
  2381.      * @param isDateTime boolean
  2382.      * @param increment boolean
  2383.      * @param $value double
  2384.      * @param anIncrement double
  2385.      * @param tmpWhichDatetime int
  2386.      * @return double date time increment $value
  2387.      */
  2388.     public function dateTimeIncrement($isDateTime$increment$value,
  2389.                                     $anIncrement$tmpWhichDatetime{
  2390.  
  2391.         if ($isDateTime{
  2392.             // TODO get the format from ... ??
  2393.             $tmpArrayDateTime=date('Y-m-d',$value);
  2394.  
  2395.             $d new DateParts($tmpArrayDateTime['year'],
  2396.                                 $tmpArrayDateTime['month'],
  2397.                                 $tmpArrayDateTime['day']);
  2398.  
  2399.             switch ($tmpWhichDatetime{
  2400.             case DateTimeStep::$HALFMONTH:
  2401.                 if ($d->day 15{
  2402.                     $d->day 15;
  2403.                 else if ($d->day 1{
  2404.                     $d->day 1;
  2405.                 else {
  2406.                     $this->incDecMonths(1$d$increment);
  2407.                     $d->day 15;
  2408.                 }
  2409.                 break;
  2410.             case DateTimeStep::$ONEMONTH:
  2411.                 $this->incDecMonths(1$d$increment);
  2412.                 break;
  2413.             case DateTimeStep::$TWOMONTHS:
  2414.                 $this->incDecMonths(2$d$increment);
  2415.                 break;
  2416.             case DateTimeStep::$THREEMONTHS:
  2417.                 $this->incDecMonths(3$d$increment);
  2418.                 break;
  2419.             case DateTimeStep::$FOURMONTHS:
  2420.                 $this->incDecMonths(4$d$increment);
  2421.                 break;
  2422.             case DateTimeStep::$SIXMONTHS:
  2423.                 $this->incDecMonths(6$d$increment);
  2424.                 break;
  2425.             case DateTimeStep::$ONEYEAR:
  2426.                 if ($increment{
  2427.                     $d->year++;
  2428.                 else {
  2429.                     $d->year--;
  2430.                 }
  2431.  
  2432.                 break;
  2433.             default:
  2434.                 if ($increment{
  2435.                     $value += $anIncrement;
  2436.                 else {
  2437.                     $value -= $anIncrement;
  2438.                 }
  2439.                 return $value;
  2440.             }
  2441.             (Double) $value $d;
  2442.         else {
  2443.             $value += $increment $anIncrement : -$anIncrement;
  2444.         }
  2445.  
  2446.         return $value;
  2447.     }
  2448.  
  2449.     /**
  2450.      * Returns the most logical Axis Label style.<br>
  2451.      * It calculates the "best candidate" label style based on how many Active
  2452.      * Series are in the Chart and if the Series has po$labels. The
  2453.      * LabelStyle property must be set to talAuto for this function to work.<br>
  2454.      * If LabelStyle is not talAuto, the LabelStyle property $value is returned.
  2455.      *
  2456.      * @return AxisLabelStyle 
  2457.      */
  2458.     public function calcLabelStyle({
  2459.         return ($this->getLabels()->iStyle == AxisLabelStyle::$AUTO?
  2460.                 $this->internalCalcLabelStyle($this->labels->iStyle;
  2461.     }
  2462.  
  2463.     public function _draw($g$calcPosAxis{
  2464.         $old $this->chart->getGraphics3D();
  2465.         $this->chart->setGraphics3D($g);
  2466.         $this->draw($calcPosAxis);
  2467.         $this->chart->setGraphics3D($old);
  2468.     }
  2469.  
  2470.     /**
  2471.      * Displays an Axis at the specified screen positions with the current
  2472.      * axis scales.<br>
  2473.      * Normally you do not need to call the Draw method directly.
  2474.      *
  2475.      * @param calcPosAxis boolean True if space allowance for Axis Labelling
  2476.      *  required
  2477.      */
  2478.     public function draw($calcPosAxis{
  2479.         if ($this->axisDraw==null{
  2480.             $this->axisDraw = new AxisDraw($this);
  2481.         }
  2482.  
  2483.         $this->axisDraw->draw($calcPosAxis);
  2484.     }
  2485.  
  2486.     private function reCalcSizeCenter({
  2487.         $this->iAxisSize = $this->iEndPos - $this->iStartPos;
  2488.         $this->iCenterPos = ($this->iStartPos + $this->iEndPos2;
  2489.         $this->internalCalcRange();
  2490.     }
  2491.  
  2492.     private function doCalculation($aStartPos$aSize{
  2493.         $this->iStartPos = $aStartPos +
  2494.                     MathUtils::round(0.01 $aSize $this->startPosition);
  2495.         $this->iEndPos = $aStartPos +
  2496.                   MathUtils::round(0.01 $aSize $this->endPosition);
  2497.     }
  2498.  
  2499.     /*protected*/ public function internalCalcPositions({
  2500.         if ($this->isDepthAxis{
  2501.             $this->doCalculation(0$this->chart->getAspect()->getWidth3D());
  2502.         else {
  2503.             $r $this->chart->getChartRect();
  2504.             if ($this->horizontal{
  2505.                 $this->doCalculation($r->x$this->chart->getChartRect()->width);
  2506.             else {
  2507.                 $this->doCalculation($r->y$this->chart->getChartRect()->height);
  2508.             }
  2509.         }
  2510.         $this->reCalcSizeCenter();
  2511.     }
  2512.  
  2513.     /**
  2514.      * Displays an Axis at the specified screen positions with the current
  2515.      * axis scales.<br>
  2516.      * Main drawing method. Custom draw methods can be overloads.
  2517.      *
  2518.      * @param posLabels int
  2519.      * @param posTitle int
  2520.      * @param posAxis int
  2521.      * @param gridVisible boolean
  2522.      */
  2523.     public function __draw($posLabels$posTitle$posAxis,
  2524.                      $gridVisible{
  2525.         $this->internalCalcPositions();
  2526.         $this->___draw($posLabels$posTitle$posAxis$gridVisible$this->iStartPos$this->iEndPos);
  2527.     }
  2528.  
  2529.     /**
  2530.      * Displays an Axis at the specified screen positions with the current
  2531.      * axis scales.<br>
  2532.      * Main drawing method. Custom draw methods can be overloads.
  2533.      *
  2534.      * @param posLabels int
  2535.      * @param posTitle int
  2536.      * @param posAxis int
  2537.      * @param gridVisible boolean
  2538.      * @param aStartPos int
  2539.      * @param aEndPos int
  2540.      */
  2541.     public function ___draw($posLabels$posTitle$posAxis,
  2542.                      $gridVisible$aStartPos,
  2543.                      $aEndPos{
  2544.         $this->getLabels()->position $posLabels;
  2545.         $this->posTitle = $posTitle;
  2546.         $this->posAxis = $posAxis;
  2547.         $this->iStartPos = $aStartPos;
  2548.         $this->iEndPos = $aEndPos;
  2549.         $this->reCalcSizeCenter();
  2550.  
  2551.         $oldgridvisible $this->getGrid()->getVisible();
  2552.         $this->grid->setVisible($gridVisible);
  2553.         $this->draw(false);
  2554.         $this->grid->setVisible($oldgridvisible);
  2555.     }
  2556.  
  2557.     /**
  2558.      * Scrolls or displaces the Axis Maximum and Minimum $values by the Offset
  2559.      * parameter.<br>
  2560.      * If you want to scroll the Axis outside Series limits,
  2561.      * CheckLimits must be false.
  2562.      *
  2563.      * @param offset double
  2564.      * @param checkLimits boolean
  2565.      */
  2566.     public function scroll($offset$checkLimits{
  2567.         if ((!$checkLimits||
  2568.             ((($offset 0&&
  2569.               ($this->maximumvalue $this->chart->internalMinMax($thisfalse,
  2570.                 $this->getHorizontal()))) ||
  2571.              (($offset 0&&
  2572.               ($this->minimumvalue >
  2573.                $this->chart->internalMinMax(thistrue$this->getHorizontal()))))
  2574.                 {
  2575.             $this->automatic false;
  2576.             $this->automaticMaximum false;
  2577.             $this->maximumvalue += $offset;
  2578.             $this->automaticMinimum false;
  2579.             $this->minimumvalue += $offset;
  2580.             $this->invalidate();
  2581.         }
  2582.     }
  2583.  
  2584.     /**
  2585.      * Changes the current Axis Minimum and Maximum scales.<br>
  2586.      * Axis.Automatic must be set to false.
  2587.      *
  2588.      * @param minDate DateTime Axis Minimum scale
  2589.      * @param maxDate DateTime Axis Maximum scale
  2590.      */
  2591.     public function setMinMaxDate($minDate$maxDate{
  2592.         $this->setMinMax($minDate->toDouble()$maxDate->toDouble());
  2593.     }
  2594.  
  2595.     /**
  2596.      * Changes the current Axis Minimum and Maximum scales.<br>
  2597.      * Axis.Automatic must be set to false.
  2598.      *
  2599.      * @param min double Axis Minimum scale
  2600.      * @param max double Axis Maximum scale
  2601.      */
  2602.     public function setMinMax($min$max{
  2603.         $this->automatic false;
  2604.         $this->automaticMinimum false;
  2605.         $this->automaticMaximum false;
  2606.  
  2607.         if ($min $max// swap
  2608.             $tmp $min;
  2609.             $min $max;
  2610.             $max $tmp;
  2611.         }
  2612.  
  2613.         $this->internalSetMinimum($min);
  2614.         $this->internalSetMaximum($max);
  2615.         if (($this->maximumvalue $this->minimumvalueself::$MINAXISRANGE{
  2616.             $this->internalSetMaximum($this->minimumvalue self::$MINAXISRANGE);
  2617.         }
  2618.     }
  2619.  
  2620.     public function setChart($c{
  2621.         parent::setChart($c);
  2622.  
  2623.         $this->labels->setChart($this->chart);
  2624.         $this->labels->axis=$this;
  2625.  
  2626.         if ($this->axisDraw!=null{
  2627.             $this->axisDraw->setChart($this->chart);
  2628.         }
  2629.     }
  2630.  
  2631.     private function setInternals({
  2632.         $this->iMaximum = $this->maximumvalue;
  2633.         $this->iMinimum = $this->minimumvalue;
  2634.         $this->internalCalcRange();
  2635.     }
  2636.  
  2637.     /**
  2638.      * Displays an Axis at the specified screen positions with the current
  2639.      * axis scales.<br>
  2640.      * Main drawing method. Custom draw methods can be overloads.
  2641.      *
  2642.      * @param posLabels int
  2643.      * @param posTitle int
  2644.      * @param posAxis int
  2645.      * @param gridVisible boolean
  2646.      * @param aMinimum double
  2647.      * @param aMaximum double
  2648.      * @param aStartPosition int
  2649.      * @param aEndPosition int
  2650.      */
  2651.     public function ____draw($posLabels$posTitle$posAxis,
  2652.                      $gridVisible$aMinimum,
  2653.                      $aMaximum,
  2654.                      $aStartPosition$aEndPosition{
  2655.         $this->_____draw($posLabels$posTitle,
  2656.              $posAxis$gridVisible,
  2657.              $aMinimum$aMaximum,
  2658.              $this->desiredIncrement,
  2659.              $aStartPosition$aEndPosition);
  2660.     }
  2661.  
  2662.     /**
  2663.      * Displays an Axis at the specified screen positions with the current
  2664.      * axis scales.<br>
  2665.      * Main drawing method. Custom draw methods can be overloads.
  2666.      *
  2667.      * @param posLabels int
  2668.      * @param posTitle int
  2669.      * @param posAxis int
  2670.      * @param gridVisible boolean
  2671.      * @param aMinimum double
  2672.      * @param aMaximum double
  2673.      * @param aIncrement double
  2674.      * @param aStartPos int
  2675.      * @param aEndPos int
  2676.      */
  2677.     public function _____draw($posLabels$posTitle,
  2678.                      $posAxis$gridVisible,
  2679.                      $aMinimum,
  2680.                      $aMaximum,
  2681.                      $aIncrement$aStartPos$aEndPos{
  2682.         $oldMin $this->minimumvalue;
  2683.         $oldMax $this->maximumvalue;
  2684.         $oldIncrement $this->desiredIncrement;
  2685.         $oldAutomatic $this->automatic;
  2686.         $this->automatic false;
  2687.         $this->minimumvalue $aMinimum;
  2688.         $this->maximumvalue $aMaximum;
  2689.         $this->desiredIncrement $aIncrement;
  2690.         $this->setInternals();
  2691.         $this->draw($posLabels$posTitle$posAxis$gridVisible$aStartPos,
  2692.              $aEndPos);
  2693.         $this->minimumvalue $oldMin;
  2694.         $this->maximumvalue $oldMax;
  2695.         $this->desiredIncrement $oldIncrement;
  2696.         $this->automatic $oldAutomatic;
  2697.         $this->setInternals();
  2698.     }
  2699. }
  2700.  
  2701.  
  2702.     public $position;
  2703.     public $rect;
  2704.  
  2705.     public function CalcLabelsResults({
  2706.     }
  2707. }
  2708.  
  2709.  
  2710. final class DateParts {
  2711.     private $year;
  2712.     private $month;
  2713.     private $day;
  2714.  
  2715.     public function DateParts($year=0$month=0$day=0{
  2716.         $this->day $day;
  2717.         $this->month $month;
  2718.         $this->year $year;
  2719.     }
  2720.  
  2721.     public function toDouble({
  2722.        // TODO return (new DateTime($this->year, $this->month, $this->day))->toDouble();
  2723.     }
  2724. }
  2725. ?>

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