You are here

class PHPExcel_Chart_Legend in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Legend.php \PHPExcel_Chart_Legend

PHPExcel_Chart_Legend

@category PHPExcel @package PHPExcel_Chart @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

Hierarchy

Expanded class hierarchy of PHPExcel_Chart_Legend

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Legend.php, line 36

View source
class PHPExcel_Chart_Legend {

  /** Legend positions */
  const xlLegendPositionBottom = -4107;

  //	Below the chart.
  const xlLegendPositionCorner = 2;

  //	In the upper right-hand corner of the chart border.
  const xlLegendPositionCustom = -4161;

  //	A custom position.
  const xlLegendPositionLeft = -4131;

  //	Left of the chart.
  const xlLegendPositionRight = -4152;

  //	Right of the chart.
  const xlLegendPositionTop = -4160;

  //	Above the chart.
  const POSITION_RIGHT = 'r';
  const POSITION_LEFT = 'l';
  const POSITION_BOTTOM = 'b';
  const POSITION_TOP = 't';
  const POSITION_TOPRIGHT = 'tr';
  private static $_positionXLref = array(
    self::xlLegendPositionBottom => self::POSITION_BOTTOM,
    self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
    self::xlLegendPositionCustom => '??',
    self::xlLegendPositionLeft => self::POSITION_LEFT,
    self::xlLegendPositionRight => self::POSITION_RIGHT,
    self::xlLegendPositionTop => self::POSITION_TOP,
  );

  /**
   * Legend position
   *
   * @var	string
   */
  private $_position = self::POSITION_RIGHT;

  /**
   * Allow overlay of other elements?
   *
   * @var	boolean
   */
  private $_overlay = TRUE;

  /**
   * Legend Layout
   *
   * @var	PHPExcel_Chart_Layout
   */
  private $_layout = NULL;

  /**
   *	Create a new PHPExcel_Chart_Legend
   */
  public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = NULL, $overlay = FALSE) {
    $this
      ->setPosition($position);
    $this->_layout = $layout;
    $this
      ->setOverlay($overlay);
  }

  /**
   * Get legend position as an excel string value
   *
   * @return	string
   */
  public function getPosition() {
    return $this->_position;
  }

  /**
   * Get legend position using an excel string value
   *
   * @param	string	$position
   */
  public function setPosition($position = self::POSITION_RIGHT) {
    if (!in_array($position, self::$_positionXLref)) {
      return false;
    }
    $this->_position = $position;
    return true;
  }

  /**
   * Get legend position as an Excel internal numeric value
   *
   * @return	number
   */
  public function getPositionXL() {
    return array_search($this->_position, self::$_positionXLref);
  }

  /**
   * Set legend position using an Excel internal numeric value
   *
   * @param	number	$positionXL
   */
  public function setPositionXL($positionXL = self::xlLegendPositionRight) {
    if (!array_key_exists($positionXL, self::$_positionXLref)) {
      return false;
    }
    $this->_position = self::$_positionXLref[$positionXL];
    return true;
  }

  /**
   * Get allow overlay of other elements?
   *
   * @return	boolean
   */
  public function getOverlay() {
    return $this->_overlay;
  }

  /**
   * Set allow overlay of other elements?
   *
   * @param	boolean	$overlay
   * @return	boolean
   */
  public function setOverlay($overlay = FALSE) {
    if (!is_bool($overlay)) {
      return false;
    }
    $this->_overlay = $overlay;
    return true;
  }

  /**
   * Get Layout
   *
   * @return PHPExcel_Chart_Layout
   */
  public function getLayout() {
    return $this->_layout;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PHPExcel_Chart_Legend::$_layout private property * Legend Layout * *
PHPExcel_Chart_Legend::$_overlay private property * Allow overlay of other elements? * *
PHPExcel_Chart_Legend::$_position private property * Legend position * *
PHPExcel_Chart_Legend::$_positionXLref private static property
PHPExcel_Chart_Legend::getLayout public function * Get Layout * *
PHPExcel_Chart_Legend::getOverlay public function * Get allow overlay of other elements? * *
PHPExcel_Chart_Legend::getPosition public function * Get legend position as an excel string value * *
PHPExcel_Chart_Legend::getPositionXL public function * Get legend position as an Excel internal numeric value * *
PHPExcel_Chart_Legend::POSITION_BOTTOM constant
PHPExcel_Chart_Legend::POSITION_LEFT constant
PHPExcel_Chart_Legend::POSITION_RIGHT constant
PHPExcel_Chart_Legend::POSITION_TOP constant
PHPExcel_Chart_Legend::POSITION_TOPRIGHT constant
PHPExcel_Chart_Legend::setOverlay public function * Set allow overlay of other elements? * *
PHPExcel_Chart_Legend::setPosition public function * Get legend position using an excel string value * *
PHPExcel_Chart_Legend::setPositionXL public function * Set legend position using an Excel internal numeric value * *
PHPExcel_Chart_Legend::xlLegendPositionBottom constant Legend positions
PHPExcel_Chart_Legend::xlLegendPositionCorner constant
PHPExcel_Chart_Legend::xlLegendPositionCustom constant
PHPExcel_Chart_Legend::xlLegendPositionLeft constant
PHPExcel_Chart_Legend::xlLegendPositionRight constant
PHPExcel_Chart_Legend::xlLegendPositionTop constant
PHPExcel_Chart_Legend::__construct public function * Create a new PHPExcel_Chart_Legend