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

Source for file ThemesList.php

Documentation is available at ThemesList.php

  1. <?php
  2.  
  3.  
  4. /**
  5.   *
  6.   * <p>Title: </p>
  7.   *
  8.   * <p>Description: ThemesList is a collection of Theme objects.</p>
  9.   *
  10.   * <p>Copyright (c) 2005-2007 by Steema Software SL. All Rights Reserved.</p>
  11.   *
  12.   * <p>Company: Steema Software SL</p>
  13.   *
  14.   * <p>Example:
  15.   * <pre><font face="Courier" size="4">
  16.   * ThemesList.applyTheme(myChart.getChart(), new
  17.   * ExcelTheme(myChart.getChart()));
  18.   * </font></pre>
  19.   * </p>
  20.   *
  21.   * @see com.steema.teechart.themes.Theme
  22.   */
  23.  class ThemesList {
  24.      
  25.      public static $OPERATHEME 0;
  26.      public static $BLACKISBLACKTHEME 1;
  27.      public static $DEFAULTTHEME 2;
  28.      public static $EXCELTHEME 3;
  29.      public static $CLASSICTHEME 4;
  30.      public static $XPTHEME 5;
  31.      public static $WEBTHEME 6;
  32.      public static $BUSINESSTHEME 7;
  33.      public static $BLUESKYTHEME 8;
  34.      public static $GRAYSCALETHEME 9;          
  35.  
  36.     /**
  37.      * Returns the number of registered Chart Theme classes.
  38.      *
  39.      * @return int 
  40.      */
  41.     public function size({
  42.         return 3;
  43.     }
  44.  
  45.         /**
  46.           * Returns index'th Theme class in list.
  47.           *
  48.           * @param index int
  49.           * @return Class 
  50.           */
  51.     public function getTheme($index{
  52.         switch ($index{
  53.         case 0:
  54.             return OperaTheme;
  55.             break;
  56.         case 1:
  57.             return BlackIsBackTheme;                        
  58.             break;
  59.         case 2:
  60.             return DefaultTheme;
  61.             break;
  62.         case 3:
  63.             return ExcelTheme;
  64.             break;
  65.         case 4:
  66.             return ClassicTheme;            
  67.             break;
  68.         case 5:
  69.             return XPTheme;                                    
  70.             break;
  71.         case 6:
  72.             return WebTheme;                        
  73.             break;
  74.         case 7:
  75.             return BusinessTheme;
  76.             break;
  77.         case 8:
  78.             return BlueSkyTheme;            
  79.             break;
  80.         case 9:
  81.             return GrayscaleTheme;            
  82.             break;
  83.         default:
  84.             return null;            
  85.         }
  86.     }
  87.  
  88.         /**
  89.           * Creates a new instance of index'th Theme and applies it to chart.
  90.           *
  91.           * @param chart IBaseChart
  92.           * @param index int
  93.           */
  94.     public static function applyTheme($chart$index{
  95.         switch ($index{
  96.         case 0:        
  97.             self::_applyTheme($chartnew OperaTheme($chart));
  98.             break;
  99.         case 1:
  100.             self::_applyTheme($chartnew BlackIsBackTheme($chart));
  101.             break;            
  102.         case 2:
  103.             self::_applyTheme($chartnew DefaultTheme($chart));
  104.             break;
  105.         case 3:
  106.             self::_applyTheme($chartnew ExcelTheme($chart));
  107.             break;
  108.         case 4:
  109.             self::_applyTheme($chartnew ClassicTheme($chart));
  110.             break;            
  111.         case 5:
  112.             self::_applyTheme($chartnew XPTheme($chart));
  113.             break;                        
  114.         case 6:
  115.             self::_applyTheme($chartnew WebTheme($chart));
  116.             break;                            
  117.         case 7:
  118.             self::_applyTheme($chartnew BusinessTheme($chart));
  119.             break;            
  120.         case 8:
  121.             self::_applyTheme($chartnew BlueSkyTheme($chart));            
  122.             break;                        
  123.         case 9:
  124.             self::_applyTheme($chartnew GrayscaleTheme($chart));
  125.             break;                                    
  126.         case 10:
  127.             self::_applyTheme($chartnew Y2009($chart));
  128.             break;                                    
  129.         default:
  130.             break;  
  131.         }              
  132.     }
  133.  
  134.         /**
  135.           * Applies Theme to Chart. Color palette is determined by the Theme class.
  136.           *
  137.           * @param chart IBaseChart
  138.           * @param theme Theme
  139.           */
  140.     public static function _applyTheme($chart$theme{
  141.         self::__applyTheme($chart$theme-1);
  142.     }
  143.  
  144.         /**
  145.           * Applies Theme to Chart and sets the Chart palette (if paletteIndex is
  146.           * different than -1).
  147.           *
  148.           * @param chart IBaseChart
  149.           * @param theme Theme
  150.           * @param paletteIndex int
  151.           */
  152.     public static function __applyTheme($chart$theme$paletteIndex{
  153.         $theme->apply();
  154.  
  155.         if ($paletteIndex != -1{
  156.             ColorPalettes::applyPalette($chart$paletteIndex);
  157.         }
  158.     }
  159.  
  160.         /**
  161.           * Returns the textual description of index'th Theme in list.
  162.           *
  163.           * @param index int
  164.           * @return String 
  165.           * @see com.steema.teechart.themes.Theme
  166.           */
  167.     public function getThemeDescription($index{       
  168.         switch ($index{
  169.         case 0:
  170.             return "Opera";
  171.         case 1:
  172.             return "BlackIsBack";            
  173.         case 2:
  174.             return "TeeChart";
  175.         case 3:
  176.             return "Excel";
  177.         case 4:
  178.             return "Classic";
  179.         case 5:
  180.             return "XP";            
  181.         case 6:
  182.             return "Web";
  183.         case 7:
  184.             return "Business"
  185.         case 8:
  186.             return "Blues";             
  187.         case 9:
  188.             return "Grayscale";                                                              
  189.         case 10:
  190.             return "Y2009";
  191.         default:
  192.             return "";
  193.         }        
  194.     }
  195. }
  196. ?>

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