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

Source for file TChart.php

Documentation is available at TChart.php

  1. <?php
  2.  
  3. /**
  4.  * TChart class
  5.  *
  6.  * Description: TChart contents
  7.  *
  8.  * @author
  9.  * @copyright (c) 1995-2010 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @link http://www.steema.com
  13.  */
  14.  
  15.   define ("REV"false);
  16.   // increases the memory to 64M
  17.   ini_set("memory_limit","64M");
  18.   // set_time_limit  ( 60 );
  19.  
  20.   // set_include_path(dirname(__FILE__) . PATH_SEPARATOR);
  21.  
  22.   require_once 'libTeeChart.php';
  23.  
  24.   class TChart implements IChartIEventListener
  25.   {
  26.     private $chart;
  27.     private $backImage;
  28.  
  29.     protected $scrollable;   
  30.     protected $listeners;
  31.  
  32.     public $mousePosition;
  33.     public $tmpImg;
  34.     public $width;
  35.     public $height;
  36.     public $eventSource;
  37.     public $eventHandlers;
  38.  
  39.     public static $controlName='TChart'
  40.  
  41.     
  42.       protected function fireChartPaint({
  43.  
  44.           $event new ChartEvent($this);
  45.         /* TEST
  46.            foreach ($this->listeners->getRaw() as $listener) {
  47.             $listener->onMyEvent($event);
  48.           }
  49.         */
  50.       }
  51.  
  52.     function onMyEvent(ChartEvent $event{
  53.           echo "Taking short break...\n";
  54.       }
  55.  
  56.     /**
  57.     * Serializes the TChart and Chart objects
  58.     */
  59.     public function serialize($chart_s,$prefix){
  60.         if (is_object($chart_s->getChart())) {
  61.             $this->tmpImg=$chart_s->getChart()->getGraphics3D()->img;
  62.             $serialized Array();
  63.             $serialized=serialize($chart_s->getChart());
  64.             $_SESSION[$prefix."Chart"=$serialized;
  65.         }
  66.     }
  67.  
  68.     /**
  69.     * Unserializes the TChart and Chart objects
  70.     */
  71.     public function unserialize($chart_s,$prefix{
  72.       if (is_string($_SESSION[$prefix."Chart"]))
  73.       {
  74.           $unserialized=unserialize($_SESSION[$prefix."Chart"]);
  75.           $unserialized->getGraphics3D()->img=$this->getGraphics3D()->img;
  76.           $chart_s->setChart($unserialized);
  77.       }
  78.     }
  79.  
  80.     /*
  81.     function  __sleep() {
  82.     }
  83.  
  84.     function __wakeup() {
  85.     }*/
  86.  
  87.     // Interceptors
  88.     function __get$property {
  89.       $method ="get{$property}";
  90.       if method_exists$this$method ) ) {
  91.         return $this->$method();
  92.       }
  93.     }
  94.  
  95.     function __set $property,$value {
  96.       $method ="set{$property}";
  97.       if method_exists$this$method ) ) {
  98.         return $this->$method($value);
  99.       }
  100.     }
  101.  
  102.     /**
  103.     * The class constructor.
  104.     */
  105.     function TChart($width=300,$height=200,$handlers=null)
  106.     {
  107.         English::setTexts();
  108.  
  109.           $this->listeners = new EventListenerList();
  110.         if ($handlers)
  111.              $this->eventHandlers = $handlers;
  112.          else
  113.              $this->eventHandlers = new EventHandlerCollection();
  114.  
  115.         $this->mousePosition = new TeePoint();
  116.  
  117.         $this->width = $width;
  118.         $this->height = $height;
  119.  
  120.         $this->chart new Chart($thisnull);  
  121.         $this->checkGraphics();
  122.  
  123.         $this->InitEvents();
  124.         $this->TriggerEvent('OnLoad'array('arg1'=>1));
  125.  
  126.         // Apply Theme
  127.         //ThemesList::_applyTheme($this->getChart(),new DefaultTheme(($this->getChart())));        
  128.         ThemesList::_applyTheme($this->getChart(),new Y2009(($this->getChart())));        
  129.    }
  130.  
  131.    public function __destruct()
  132.    {
  133.         $this->TriggerEvent('OnUnload'array('arg2'=>2));
  134.    }
  135.  
  136.    public function RegisterEventHandler($handler)
  137.    {
  138.         if ($this->events->Contains($handler->GetEventName()))
  139.             $this->eventHandlers->Add($handler);
  140.    }
  141.  
  142.    private function InitEvents()
  143.    {
  144.         $this->listeners->add(new ChartEvent('OnLoad'));
  145.         $this->listeners->add(new ChartEvent('OnUnload'));
  146.         $this->listeners->add(new ChartEvent('OnGetAxisLabel'));
  147.    }
  148.  
  149.    public function TriggerEvent($eventName,$args)
  150.    {
  151.         $this->eventHandlers->RaiseEvent($eventName,$this,$args);
  152.    }
  153.  
  154.     /**
  155.      * Cleans up any resources being used.
  156.      *
  157.      * @param disposing boolean
  158.      */
  159.     protected function dispose($disposing{
  160.         if ($disposing{
  161.             $this->chart->removeAllComponents();
  162.         }
  163.     }
  164.  
  165.     /**
  166.      * Returns a Dimension object of prefered size.
  167.      */
  168.     public function getPreferredSize({
  169.         return new Dimension(400250);
  170.     }
  171.  
  172.     /**
  173.      * Determines which Chart is being printed.
  174.      *
  175.      * @return boolean 
  176.      */
  177.     public function getPrinting({
  178.         return $this->chart->printing;
  179.     }
  180.  
  181.     /**
  182.      * Determines which Chart is being printed.
  183.      *
  184.      * @param boolean $value 
  185.      */
  186.     public function setPrinting($value{
  187.         $this->chart->printing $value;
  188.         $this->doInvalidate();
  189.     }
  190.  
  191.     /**
  192.      * True when the Chart is internally drawing into a Metafile image.
  193.      *
  194.      * @return boolean 
  195.      */
  196.     public function getMetafiling({
  197.         return $this->chart->getGraphics3D()->getMetafiling();
  198.     }
  199.  
  200.     /**
  201.      * Obsolete.&nbsp;Please use Aspect->ClipPoints instead.
  202.      *
  203.      * @return boolean 
  204.      *
  205.      * @deprecated
  206.      */
  207.     public function getClipPoints({
  208.         return $this->chart->getAspect()->getClipPoints();
  209.     }
  210.  
  211.     /**
  212.      * Obsolete. Please use Aspect->ClipPoints instead.
  213.      *
  214.      * @param boolean $value 
  215.      */
  216.     public function setClipPoints($value{
  217.         $this->chart->getAspect()->setClipPoints($value);
  218.     }
  219.  
  220.     /**
  221.      * Obsolete.&nbsp;Please use getSeries.getApplyZOrder() instead.
  222.      *
  223.      * @return boolean 
  224.      *
  225.      * @deprecated
  226.      */
  227.     public function getApplyZOrder({
  228.         return $this->chart->getSeries()->getApplyZOrder();
  229.     }
  230.  
  231.     /**
  232.      * Obsolete.&nbsp;Please use getSeries().setApplyZOrder() instead.
  233.      *
  234.      * @param boolean $value 
  235.      *
  236.      * @deprecated
  237.      */
  238.     public function setApplyZOrder($value{
  239.         $this->chart->getSeries()->setApplyZOrder($value);
  240.     }
  241.  
  242.     /**
  243.      * The color the Chart rectangle is filled with.<br>
  244.      * The chart rectangle is the screen area between axes. <br>
  245.      * Setting BackColor to Color.EMPTY does not fill the rectangle. <br>
  246.      * Assigning Color->_empty to tChart->getBackColor() makes TeeChart NOT fill the
  247.      * Chart back area, so Gradient fills and Background Bitmaps can be shown.
  248.      *
  249.      * @return Color 
  250.      */
  251.     public function getBackColor({
  252.         return $this->chart->getPanel()->getColor();
  253.     }
  254.  
  255.     /**
  256.      * Sets the color the Chart rectangle is filled with.<br>
  257.      *
  258.      * @param Color $value 
  259.      */
  260.     public function setBackColor($value{
  261.         $this->setBackground($value);
  262.         $this->doInvalidate();
  263.       }
  264.  
  265.     public function setBackground($value{
  266.         $this->chart->getPanel()->setColor($value);
  267.     }
  268.  
  269.     public function getBackground({
  270.         return $this->chart->getPanel()->getColor();
  271.     }
  272.  
  273.     public function mouseDragged($e{
  274.         $this->mousePosition = $e->getPoint();
  275.     }
  276.  
  277.     /**
  278.      * Captures current mouse position every time the mouse is moved.
  279.      * @param MouseEvent $e 
  280.      */
  281.     public function mouseMoved($e{
  282.         $this->mousePosition = $e->getPoint();
  283.     }
  284.  
  285.     /**
  286.      * Obsolete. Please use mousePosition field instead.
  287.      *
  288.      * @return TeePoint 
  289.      *
  290.      * @deprecated
  291.      */
  292.     public function getGetCursorPos({
  293.         return $this->mousePosition;
  294.     }
  295.  
  296.     /**
  297.      * Adds a new Series.
  298.      *
  299.      * @param Series $s 
  300.      * @return Series 
  301.      */
  302.     public function addSeries($s{
  303.         $s->setChart($this->chart);
  304.         $series $this->chart->getSeries()->add($s);
  305.  
  306.         // TODO $this->fireChartAdded(new ChartEvent($s, ChartEvent.CHART_ADDED));
  307.         return $series;
  308.     }
  309.  
  310.     /**
  311.      * Enables/Disables repainting of Chart when points are added.<br>
  312.      * Use AutoRepaint false to disable Chart repainting whilst, for example,
  313.      * adding a large number of points to a Chart Series. This avoidss
  314.      * repainting of the Chart whilst the points are added. <br>
  315.      * AutoRepaint may be re-enabled, followed by a manual Repaint command
  316.      * when all points are added. <br>
  317.      * Default value: true
  318.      *
  319.      * @return boolean 
  320.      */
  321.     public function getAutoRepaint({
  322.         return $this->chart->getAutoRepaint();
  323.     }
  324.  
  325.     /**
  326.      * Enables/Disables repainting of Chart when points are added.<br>
  327.      * Default value: true
  328.      *
  329.      * @see TChart#getAutoRepaint
  330.      * @param boolean $value 
  331.      */
  332.     public function setAutoRepaint($value{
  333.         $this->chart->setAutoRepaint($value);
  334.         // Do not call invalidate here.
  335.     }
  336.  
  337.     public function getImage({
  338.         return $this->getExport()->getImage()->image($this->width$this->height);
  339.     }
  340.  
  341.     public function setHeight($value{
  342.         $this->height=$value;
  343.         $g=$this->getGraphics3D();
  344.  
  345.         $tmpImg imagecreatetruecolor($this->width$this->height);
  346.         imagecopyresized($tmpImg,$g->img,0,0,0,0,$this->width,
  347.  
  348.         $this->height,ImageSX($g->img),ImageSY($g->img));
  349.         $g->img=$tmpImg;
  350.  
  351.         $this->doInvalidate();
  352.     }
  353.  
  354.     public function setWidth($value{
  355.         $this->width=$value;
  356.         $g=$this->getGraphics3D();
  357.  
  358.         $tmpImg imagecreatetruecolor($this->width$this->height);
  359.         imagecopyresized($tmpImg,$g->img,0,0,0,0,$this->width,
  360.  
  361.         $this->height,ImageSX($g->img),ImageSY($g->img));
  362.         $g->img=$tmpImg;
  363.  
  364.         $this->doInvalidate();
  365.     }
  366.  
  367.     /**
  368.      * Removes all Series.
  369.      */
  370.     public function removeAllSeries({
  371.         $this->chart->getSeries()->clear();
  372.     }
  373.  
  374.     /**
  375.      * Obsolete.&nbsp;Use TChart.<!-- -->Series.<!-- -->Exchange() instead.
  376.      *
  377.      * @param int $series1 
  378.      * @param int $series2 
  379.      *
  380.      * @deprecated
  381.      */
  382.     public function exchangeSeries($series1$series2{
  383.         $this->chart->getSeries()->exchange($series1$series2);
  384.     }
  385.  
  386.     /**
  387.      * Use TChart.<!-- -->getWalls()<!-- -->getPen() instead.
  388.      *
  389.      * @return ChartPen 
  390.      */
  391.     public function getFrame({
  392.         return $this->chart->getWalls()->getBack()->getPen();
  393.     }
  394.  
  395.     /**
  396.      * Returns the number of Series in Chart.
  397.      *
  398.      * @return int 
  399.      */
  400.     public function getSeriesCount({
  401.         return sizeof($this->chart->getSeries());
  402.     }
  403.  
  404.     public function setScrollable($scrollable{
  405.         $this->scrollable = $scrollable;
  406.     }
  407.  
  408.     public function removeScrollable({
  409.         $this->scrollable = null;
  410.     }
  411.  
  412.     /**
  413.      * Returns background image of TChart
  414.      * @return Image 
  415.      */
  416.     public function getBackgroundImage({
  417.         if ($this->backImage == null{
  418.             $this->backImage new BufferedImage($this->width$this->height0);
  419.         }
  420.         return $this->backImage;
  421.     }
  422.  
  423.     public function doDrawImage($g{
  424.         if ($this->chart->getPanel()->getImage(!= null{
  425.             $g->draw($this->chart->getChartRect()$this->chart->getPanel()->getImage(),
  426.             $this->getPanel()->getBrush()->getImageMode(),
  427.             $this->getPanel()->getShapeBorders(),false);
  428.         }
  429.     }
  430.  
  431.     public function paint($g$rectangle{
  432.         TChart::$controlName 'TChart';        
  433.         
  434.         $g=$this->chart->getGraphics3D();
  435.         $g->setGraphics($g);
  436.  
  437.         if ($this->getBorder(!= null{
  438.             $i $this->getInsets();
  439.             $rectangle->+= $i->left;
  440.             $rectangle->+= $i->top;
  441.             $rectangle->width -= ($i->left $i->right);
  442.             $rectangle->height -= ($i->top $i->bottom);
  443.         }
  444.         $this->chart->paint($g$rectangle);
  445.  
  446.         if ($this->getBorder(!= null{
  447.             $this->getBorder()->paintBorder($this$g00$this->width$this->height);
  448.         }
  449.     }
  450.  
  451.     public function _paint($g$width$height{
  452.         $this->paint($gnew Rectangle(00$width$height));
  453.     }
  454.  
  455.     // Events
  456.     public function doBeforeDrawAxes({
  457.       /*TODO
  458.       $this-> callEvent('onBeforeDrawAxes', array());
  459.       $this->fireChartPaint(new ChartDrawEvent($this, ChartDrawEvent.PAINTING,
  460.                                           ChartDrawEvent.AXES)); 
  461.       */
  462.     }
  463.  
  464.     public function doAfterDrawSeries({
  465.         $this->fireChartPaint(new ChartDrawEvent($thisChartDrawEvent.PAINTED,
  466.                                           ChartDrawEvent.SERIES));
  467.     }
  468.  
  469.     public function doBeforeDrawSeries({
  470.         /* TODO 
  471.         $this->fireChartPaint();
  472.         $this->fireChartPaint(new ChartDrawEvent($this, ChartDrawEvent::$PAINTING,
  473.                                           ChartDrawEvent::$SERIES));
  474.         */
  475.     }
  476.  
  477.     public function doAfterDraw({
  478.         $this->fireChartPaint(new ChartDrawEvent($thisChartDrawEvent.PAINTED,
  479.                                           ChartDrawEvent.CHART));
  480.     }
  481.  
  482.     public function doBeforeDraw({
  483.         $this->fireChartPaint(new ChartDrawEvent($thisChartDrawEvent.PAINTING,
  484.                                           ChartDrawEvent.CHART));
  485.     }
  486.  
  487.     public function doClickSeries($sender$s$valueIndex$e{
  488.         $this->fireSeriesClick(new SeriesMouseEvent($sSeriesMouseEvent.SERIES_CLICKED,
  489.                                              $valueIndex$e));
  490.     }
  491.  
  492.     public function doAllowScroll($a$delta$result{
  493.         $result->allow true;
  494.         if ($this->scrollable != null{
  495.             $result $this->scrollable->isScrollable($a$result);
  496.         }
  497.     }
  498.  
  499.     public function checkBackground($sender$e{
  500.         if ($this->fireChartClicked(new ChartMouseEvent($sender,
  501.                                                  ChartMouseEvent.MOUSE_CLICKED,
  502.                                                  ClickedParts.CHARTRECTe))) {
  503.             $this->chart->cancelMouse true;
  504.             $this->chart->iClicked $this->chart->cancelMouse;
  505.         }
  506.     }
  507.  
  508.     public function getCursor({
  509.         //  return parent::getCursor();
  510.     }
  511.  
  512.     /**
  513.      *
  514.      * @param value Chart
  515.      */
  516.     public function setChart($value{
  517.         if ($value != null{
  518.             $this->chart=$value;
  519.             $this->getChart()->setParent($this);
  520.         }
  521.     }
  522.  
  523.     public function setAxes($axes{
  524.         $this->chart->setAxes($axes);
  525.     }
  526.  
  527.     public function setFooter($footer{
  528.         $this->chart->setFooter($footer);
  529.     }
  530.  
  531.     public function setFont($font{
  532.         $this->getGraphics3D()->setFont($font);
  533.     }
  534.  
  535.     public function setHeader($header{
  536.         $this->chart->setHeader($header);
  537.     }
  538.  
  539.     public function setLegend($legend{
  540.         $this->chart->setLegend($legend);
  541.     }
  542.  
  543.     public function setSubFooter($subFooter{
  544.         $this->chart->setSubFooter($subFooter);
  545.     }
  546.  
  547.     public function setSubHeader($subHeader{
  548.         $this->chart->setSubHeader($subHeader);
  549.     }
  550.  
  551.     public function setWalls($walls{
  552.         $this->chart->setWalls($walls);
  553.     }
  554.  
  555.     public function setZoom($zoom{
  556.         $this->chart->setZoom($zoom);
  557.     }
  558.  
  559.     public function setPrinter($printer{
  560.         $this->chart->setPrinter($printer);
  561.     }
  562.  
  563.     public function setPanning($panning{
  564.         $this->chart->setPanning($panning);
  565.     }
  566.  
  567.     public function setPanel($panel{
  568.         $this->chart->setPanel($panel);
  569.     }
  570.  
  571.     public function setPage($page{
  572.         $this->chart->setPage($page);
  573.     }
  574.  
  575.     public function getControl({
  576.         return $this;
  577.     }
  578.  
  579.     public function doBaseInvalidate({
  580.     }
  581.  
  582.     public function pointToScreen($p{
  583.         $screen $this->getLocationOnScreen();
  584.         $p->move-$screen->x-$screen->y);
  585.         return $p;
  586.     }
  587.  
  588.     public function setCursor($c{
  589.         //  parent::setCursor($c);
  590.         $this->chart->originalCursor $c;
  591.     }
  592.  
  593.     public function refreshControl({
  594.         $this->paintImmediately($this->chart->chartBounds);
  595.     }
  596.  
  597.     public function createToolTip()
  598.     {
  599.         return new JMultiLineToolTip();
  600.     }
  601.  
  602.     /**
  603.      * Defines the Chart to display.
  604.      *
  605.      * @return Chart 
  606.      */
  607.     public function getChart({
  608.         return $this->chart;
  609.     }
  610.  
  611.     /**
  612.      * The text for the Footer, Header, SubFooter and SubHeader.
  613.      *
  614.      * @return String 
  615.      */
  616.     public function getText({
  617.         return ($this->chart == null"" $this->chart->getHeader()->getText();
  618.     }
  619.  
  620.     /**
  621.      * Sets the text for the Footer, Header, SubFooter and SubHeader.
  622.      *
  623.      * @param String $value 
  624.      */
  625.     public function setText($value{
  626.         if ($this->chart != null{
  627.             $this->chart->getHeader()->setText($value);
  628.         }
  629.     }
  630.  
  631.     /**
  632.      * Background visible attributes.<br>
  633.      * Provides access, via the Panel Interface, to all Chart Panel properties.
  634.      *
  635.      * @return TeePanel 
  636.      */
  637.     public function getPanel({
  638.         return $this->getChart()->getPanel();
  639.     }
  640.  
  641.     /**
  642.      * Printing related attributes.
  643.      *
  644.      * @return Printer 
  645.      */
  646.     public function getPrinter({
  647.         return $this->getChart()->getPrinter();
  648.     }
  649.  
  650.     /**
  651.      * Accesses multiple page characteristics of the Chart.
  652.      *
  653.      * @return Page 
  654.      */
  655.     public function getPage({
  656.         return $this->chart->getPage();
  657.     }
  658.  
  659.     /**
  660.      * Legend characteristics.<br>
  661.      * The Legend property determines the text and drawing attributes of
  662.      * Chart's textual representation of Series and Series values.  <br>
  663.      * The Legend class draws a rectangle and for each Series in a Chart
  664.      * (or for each point in a Series) outputs a text representation of
  665.      * that Series (or that point). <br>
  666.      * You can use the Legend.LegendStyle and Legend.TextStyle properties to
  667.      * control the text used to draw the legend. <br>
  668.      * The Legend can be positioned at Left, Right, Top and Bottom chart sides
  669.      * using the Legend.Alignment property. <br>
  670.      * Use the Legend.Visible property to show / hide the Legend. <br>
  671.      * The Inverted property makes Legend to draw text starting from bottom.<br>
  672.      * The Frame, Font and Color properties allow you to change Legend
  673.      * appearance. <br>
  674.      * The Legend.ColorWidth property determines the percent width of each
  675.      * item's "colored" mark. <br>
  676.      * The Legend.FirstValue property controls which Series (or Series point)
  677.      * will be used to draw first Legend item. <br>
  678.      *
  679.      * @return Legend 
  680.      */
  681.     public function getLegend({
  682.         return $this->chart->getLegend();
  683.     }
  684.  
  685.     /**
  686.      *
  687.      * Defines the Text and formatting properties to be drawn at the top of
  688.      * the Chart.<br>
  689.      * Use Text to enter the desired Header lines, set Visible to True and
  690.      * change the Font, Frame and Brush methods.<br>
  691.      * Use Alignment to control text output position.
  692.      *
  693.      * @return Header 
  694.      */
  695.     public function getHeader({
  696.         return $this->getChart()->getHeader();
  697.     }
  698.  
  699.     /**
  700.      * Defines Text shown directly below Header.<br>
  701.      * Use the Text method to enter the desired SubHeader lines, set Visible
  702.      * to True and change the Font, Frame and Brush methods.<br>
  703.      * Use the Alignment method to control text output position.
  704.      *
  705.      * @return Header 
  706.      */
  707.     public function getSubHeader({
  708.         return $this->chart->getSubHeader();
  709.     }
  710.  
  711.     /**
  712.      * Determines the Font characteristics.
  713.      *
  714.      * @return Font 
  715.      */
  716.     public function getFont({
  717.         return $this->getGraphics3D()->getFont();
  718.     }
  719.  
  720.     /**
  721.      * Defines Text shown at the bottom of the Chart.<br>
  722.      * Use Text to enter the desired Footer lines, set Visible to True and
  723.      * change the Font, Frame and Brush methods.<br>
  724.      * Use Alignment to control text output position.
  725.      *
  726.      * @return Footer 
  727.      */
  728.     public function getFooter({
  729.         return $this->chart->getFooter();
  730.     }
  731.  
  732.     /**
  733.      * Accesses the Zoom characteristics of the Chart.
  734.      *
  735.      * @return Zoom 
  736.      */
  737.     public function getZoom({
  738.         return $this->chart->getZoom();
  739.     }
  740.  
  741.     /**
  742.      * Accesses Panning characteristics. <br><br>
  743.      * Scrolling speed depends on: <br>
  744.      *    The number of Series and Series Points. <br>
  745.      *    The Chart Width and Height. <br>
  746.      *    The computer processor and Video card processor speed. <br>
  747.      *    The Video resolution and number of colors. <br>
  748.      *    The Windows version and the Video driver. <br>
  749.      *    The speed when dragging the mouse !
  750.      *
  751.      * @return Scroll 
  752.      */
  753.     public function getPanning({
  754.         return $this->chart->getPanning();
  755.     }
  756.  
  757.     /**
  758.      * Defines Text shown directly above Footer.<br>
  759.      * Use Text to enter the desired SubFooter lines, set Visible to True and
  760.      * change the Font, Frame and Brush methods.<br>
  761.      * Use Alignment to control text output position.
  762.      *
  763.      * @return Footer 
  764.      */
  765.     public function getSubFooter({
  766.         return $this->chart->getSubFooter();
  767.     }
  768.  
  769.     /**
  770.      * Accesses view characteristics of the Chart.<br>
  771.      * 3D view parameters.
  772.      *
  773.      * @return Aspect 
  774.      */
  775.     public function getAspect({
  776.         return $this->chart->getAspect();
  777.     }
  778.  
  779.     /**
  780.      * Obsolete.&nbsp;Please use getGraphics3D function.
  781.      *
  782.      * @return IGraphics3D 
  783.      * @deprecated
  784.      */
  785.     public function getCanvas({
  786.         return $this->getGraphics3D();
  787.     }
  788.  
  789.     /**
  790.      * Obsolete.&nbsp;Please use setGraphics3D method.
  791.      *
  792.      * @param IGraphics3D $value 
  793.      * @deprecated
  794.      */
  795.     public function setCanvas($value{
  796.         $this->setGraphics3D($value);
  797.         $this->checkGraphics();
  798.     }
  799.  
  800.     /**
  801.      * Used to access TeeChart Draw attributes.
  802.      *
  803.      * @param IGraphics3D $value 
  804.      */
  805.     public function setGraphics3D($value{
  806.         $this->chart->setGraphics3D($value);
  807.     }
  808.  
  809.     /**
  810.      * Collection of Series contained in this Chart.<br><br>
  811.      * TeeChart Series are the data display method type, e.g. Line Series,
  812.      * Bar Series, Pie Series etc. You can mix different Series types in a
  813.      * Chart according to your requirements, thus your design is not limited to
  814.      * just one 'Chart type' defined by TeeChart. The concept of Chart type
  815.      * being virtually obsolete in terms of the number of permutations of
  816.      * Charts (Series type mix) you may create. <br><br>
  817.      * For more information please see "Tutorial 6 - Working with Series".
  818.      *
  819.      * @param int $index 
  820.      * @return SeriesCollection or Series depending if parameter has been passed
  821.      */
  822.     public function getSeries($index=-1{
  823.         if ($index==-1)
  824.                 return $this->chart->getSeries();
  825.         else
  826.                 return $this->chart->getSeries($index);
  827.     }
  828.  
  829.     /**
  830.      * Collection of Tool components contained in this Chart.
  831.      *
  832.      * @return ToolsCollection 
  833.      */
  834.     public function getTools({
  835.         return $this->chart->getTools();
  836.     }
  837.  
  838.     /**
  839.      * Accesses left, bottom and back wall characteristics of the Chart.
  840.      *
  841.      * @return Walls 
  842.      */
  843.     public function getWalls({
  844.         return $this->chart->getWalls();
  845.     }
  846.  
  847.     /**
  848.      * Collection of predefined and custom axis objects.
  849.      *
  850.      * @return Axes 
  851.      */
  852.     public function getAxes({
  853.         return $this->chart->getAxes();
  854.     }
  855.  
  856.     /**
  857.      * Accesses Chart export attributess.
  858.      *
  859.      * @return Exports 
  860.      */
  861.     public function getExport({
  862.         return $this->getChart()->getExport();
  863.     }
  864.  
  865.     /**
  866.      * Accesses Chart import attributes.
  867.      *
  868.      * @return Imports 
  869.      */
  870.     public function getImport({
  871.         return $this->chart->getImport();
  872.     }
  873.  
  874.     public function setSeries($series{
  875.         $this->chart->setSeries($series);
  876.     }
  877.  
  878.     public function _setSeries($index$value{
  879.         $this->chart->series->setSeries($index$value);
  880.     }
  881.  
  882.     private function prepareGraphics({
  883.         $this->checkGraphics()->setGraphics($this->getGraphics());
  884.     }
  885.  
  886.     public function setToolTip($tool$text{
  887.         $this->tool->setToolTip($this$text);
  888.     }
  889.  
  890.     public function setTools($value{
  891.         $this->chart->setTools($value);
  892.     }
  893.  
  894.     // TESTS
  895.       function addMyEventListener(IEventListener $listener{
  896.           $this->listeners->add($listener);
  897.       }
  898.  
  899.     public function doInvalidate({
  900.         $this->paintComponent($this->getGraphics3D());
  901.     }
  902.  
  903.     protected function paintComponent($g,$rec=null{
  904.         $this->checkGraphics()->setGraphics($g);
  905.  
  906.         if($rec==null
  907.         {
  908.           $tmp new Rectangle(0,0,0,0);
  909.  
  910.           $tmp->0;
  911.           $tmp->0;
  912.           $tmp->width=$this->width;
  913.           $tmp->height=$this->height;
  914.         }
  915.         else
  916.         {
  917.             $tmp $rec;
  918.         }        
  919.         $this->chart->_paint($this->chart->getGraphics3D(),$tmp);
  920.     }
  921.  
  922.     /**
  923.     * Render the chart image
  924.     *
  925.     * @access  public
  926.     * @param   string     Name of the file to render the image to (optional)
  927.     */
  928.     function render($fileName null)
  929.     {
  930.         $this->chart->setAutoRepaint(true);
  931.         $g=$this->chart->getGraphics3D();
  932.  
  933.         /*TODO if ($g->getImageReflection()==true) {
  934.           $reflection=$g->doReflection($g->img);
  935.         }*/
  936.  
  937.         if ($g instanceof CanvasMing
  938.         {
  939.              $g->getImg()->save($fileName);            
  940.         }
  941.         else
  942.         {
  943.           if ($g->getImageInterlace()==true{
  944.             imageinterlace($g->img,true);
  945.           }
  946.  
  947.           if(isset($fileName))
  948.                   imagepng($g->img$fileName);
  949.           else
  950.                   imagepng($g->img);
  951.         }
  952.     }
  953.  
  954.     public function checkGraphics({
  955.         $g3D=$this->getGraphics3D();
  956.  
  957.         if ($g3D == null{
  958.             $g3D new GraphicsGD($this->chart,$this->width,$this->height);
  959.             $g3D->createImage();
  960.             $this->chart->setGraphics3D($g3D);            
  961.         }
  962.  
  963.         return $g3D;
  964.     }
  965.  
  966.     /**
  967.      * Used to access TeeChart Draw attributes.
  968.      *
  969.      * @return GraphicsGD 
  970.      */
  971.     public function getGraphics3D({
  972.         return ($this->chart == nullnull $this->chart->getGraphics3D();
  973.     }
  974.  
  975.     public function getBuildNumber({
  976.         return Texts::$BuildNumber;
  977.     }
  978.     
  979.     public function doZoomed($sender{
  980.         //  fireChartMotion(new ChartEvent(sender, ChartEvent.CHART_ZOOMED));
  981.         $this->doBaseInvalidate();
  982.     }
  983.     
  984.   }
  985. ?>

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