2012-02-08 21:17:39 +00:00
|
|
|
<?php
|
2015-05-11 21:38:52 +00:00
|
|
|
|
2012-02-08 21:17:39 +00:00
|
|
|
/**
|
2015-05-11 21:38:52 +00:00
|
|
|
* PHPExcel_Chart
|
2012-02-08 21:17:39 +00:00
|
|
|
*
|
2015-05-02 22:50:37 +00:00
|
|
|
* Copyright (c) 2006 - 2015 PHPExcel
|
2012-02-08 21:17:39 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
2015-05-11 21:38:52 +00:00
|
|
|
* @category PHPExcel
|
|
|
|
* @package PHPExcel_Chart
|
|
|
|
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
|
|
|
* @version ##VERSION##, ##DATE##
|
2012-02-08 21:17:39 +00:00
|
|
|
*/
|
|
|
|
class PHPExcel_Chart
|
|
|
|
{
|
2015-05-11 21:38:52 +00:00
|
|
|
/**
|
|
|
|
* Chart Name
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2015-05-18 15:39:04 +00:00
|
|
|
private $name = '';
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Worksheet
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Worksheet
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $worksheet;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Chart Title
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Chart_Title
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $title;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Chart Legend
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Chart_Legend
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $legend;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* X-Axis Label
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Chart_Title
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $xAxisLabel;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Y-Axis Label
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Chart_Title
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $yAxisLabel;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Chart Plot Area
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Chart_PlotArea
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $plotArea;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Plot Visible Only
|
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $plotVisibleOnly = true;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Display Blanks as
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $displayBlanksAs = '0';
|
2012-02-08 21:17:39 +00:00
|
|
|
|
2015-05-13 10:27:01 +00:00
|
|
|
/**
|
|
|
|
* Chart Asix Y as
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Chart_Axis
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $yAxis;
|
2015-05-13 10:27:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Chart Asix X as
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Chart_Axis
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $xAxis;
|
2015-05-13 10:27:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Chart Major Gridlines as
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Chart_GridLines
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $majorGridlines;
|
2015-05-13 10:27:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Chart Minor Gridlines as
|
|
|
|
*
|
|
|
|
* @var PHPExcel_Chart_GridLines
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $minorGridlines;
|
2012-02-08 21:17:39 +00:00
|
|
|
|
2015-05-11 21:38:52 +00:00
|
|
|
/**
|
|
|
|
* Top-Left Cell Position
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $topLeftCellRef = 'A1';
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Top-Left X-Offset
|
|
|
|
*
|
|
|
|
* @var integer
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $topLeftXOffset = 0;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Top-Left Y-Offset
|
|
|
|
*
|
|
|
|
* @var integer
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $topLeftYOffset = 0;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bottom-Right Cell Position
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $bottomRightCellRef = 'A1';
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bottom-Right X-Offset
|
|
|
|
*
|
|
|
|
* @var integer
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $bottomRightXOffset = 10;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bottom-Right Y-Offset
|
|
|
|
*
|
|
|
|
* @var integer
|
|
|
|
*/
|
2015-05-17 09:22:51 +00:00
|
|
|
private $bottomRightYOffset = 10;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
|
|
|
|
{
|
2015-05-18 15:39:04 +00:00
|
|
|
$this->name = $name;
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->title = $title;
|
|
|
|
$this->legend = $legend;
|
|
|
|
$this->xAxisLabel = $xAxisLabel;
|
|
|
|
$this->yAxisLabel = $yAxisLabel;
|
|
|
|
$this->plotArea = $plotArea;
|
|
|
|
$this->plotVisibleOnly = $plotVisibleOnly;
|
|
|
|
$this->displayBlanksAs = $displayBlanksAs;
|
|
|
|
$this->xAxis = $xAxis;
|
|
|
|
$this->yAxis = $yAxis;
|
|
|
|
$this->majorGridlines = $majorGridlines;
|
|
|
|
$this->minorGridlines = $minorGridlines;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Name
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName()
|
|
|
|
{
|
2015-05-18 15:39:04 +00:00
|
|
|
return $this->name;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Worksheet
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Worksheet
|
|
|
|
*/
|
|
|
|
public function getWorksheet()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->worksheet;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set Worksheet
|
|
|
|
*
|
|
|
|
* @param PHPExcel_Worksheet $pValue
|
|
|
|
* @throws PHPExcel_Chart_Exception
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setWorksheet(PHPExcel_Worksheet $pValue = null)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->worksheet = $pValue;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Title
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Chart_Title
|
|
|
|
*/
|
|
|
|
public function getTitle()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->title;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set Title
|
|
|
|
*
|
|
|
|
* @param PHPExcel_Chart_Title $title
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setTitle(PHPExcel_Chart_Title $title)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->title = $title;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Legend
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Chart_Legend
|
|
|
|
*/
|
|
|
|
public function getLegend()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->legend;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set Legend
|
|
|
|
*
|
|
|
|
* @param PHPExcel_Chart_Legend $legend
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setLegend(PHPExcel_Chart_Legend $legend)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->legend = $legend;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get X-Axis Label
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Chart_Title
|
|
|
|
*/
|
|
|
|
public function getXAxisLabel()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->xAxisLabel;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set X-Axis Label
|
|
|
|
*
|
|
|
|
* @param PHPExcel_Chart_Title $label
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setXAxisLabel(PHPExcel_Chart_Title $label)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->xAxisLabel = $label;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Y-Axis Label
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Chart_Title
|
|
|
|
*/
|
|
|
|
public function getYAxisLabel()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->yAxisLabel;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set Y-Axis Label
|
|
|
|
*
|
|
|
|
* @param PHPExcel_Chart_Title $label
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
2015-05-13 10:27:01 +00:00
|
|
|
public function setYAxisLabel(PHPExcel_Chart_Title $label)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->yAxisLabel = $label;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Plot Area
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Chart_PlotArea
|
|
|
|
*/
|
|
|
|
public function getPlotArea()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->plotArea;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Plot Visible Only
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function getPlotVisibleOnly()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->plotVisibleOnly;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set Plot Visible Only
|
|
|
|
*
|
|
|
|
* @param boolean $plotVisibleOnly
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setPlotVisibleOnly($plotVisibleOnly = true)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->plotVisibleOnly = $plotVisibleOnly;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Display Blanks as
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getDisplayBlanksAs()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->displayBlanksAs;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set Display Blanks as
|
|
|
|
*
|
|
|
|
* @param string $displayBlanksAs
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setDisplayBlanksAs($displayBlanksAs = '0')
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->displayBlanksAs = $displayBlanksAs;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
2012-02-08 21:17:39 +00:00
|
|
|
|
|
|
|
|
2015-05-13 10:27:01 +00:00
|
|
|
/**
|
|
|
|
* Get yAxis
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Chart_Axis
|
|
|
|
*/
|
|
|
|
public function getChartAxisY()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
if ($this->yAxis !== null) {
|
|
|
|
return $this->yAxis;
|
2015-05-13 10:27:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return new PHPExcel_Chart_Axis();
|
2014-07-14 14:59:53 +00:00
|
|
|
}
|
|
|
|
|
2015-05-13 10:27:01 +00:00
|
|
|
/**
|
|
|
|
* Get xAxis
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Chart_Axis
|
|
|
|
*/
|
|
|
|
public function getChartAxisX()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
if ($this->xAxis !== null) {
|
|
|
|
return $this->xAxis;
|
2015-05-13 10:27:01 +00:00
|
|
|
}
|
2014-07-14 14:59:53 +00:00
|
|
|
|
2015-05-13 10:27:01 +00:00
|
|
|
return new PHPExcel_Chart_Axis();
|
2014-07-14 14:59:53 +00:00
|
|
|
}
|
|
|
|
|
2015-05-13 10:27:01 +00:00
|
|
|
/**
|
|
|
|
* Get Major Gridlines
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Chart_GridLines
|
|
|
|
*/
|
|
|
|
public function getMajorGridlines()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
if ($this->majorGridlines !== null) {
|
|
|
|
return $this->majorGridlines;
|
2015-05-13 10:27:01 +00:00
|
|
|
}
|
2014-07-14 14:59:53 +00:00
|
|
|
|
2015-05-13 10:27:01 +00:00
|
|
|
return new PHPExcel_Chart_GridLines();
|
2014-07-14 14:59:53 +00:00
|
|
|
}
|
|
|
|
|
2015-05-13 10:27:01 +00:00
|
|
|
/**
|
|
|
|
* Get Minor Gridlines
|
|
|
|
*
|
|
|
|
* @return PHPExcel_Chart_GridLines
|
|
|
|
*/
|
|
|
|
public function getMinorGridlines()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
if ($this->minorGridlines !== null) {
|
|
|
|
return $this->minorGridlines;
|
2015-05-13 10:27:01 +00:00
|
|
|
}
|
2014-07-14 14:59:53 +00:00
|
|
|
|
2015-05-13 10:27:01 +00:00
|
|
|
return new PHPExcel_Chart_GridLines();
|
2014-07-14 14:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-11 21:38:52 +00:00
|
|
|
/**
|
|
|
|
* Set the Top Left position for the chart
|
|
|
|
*
|
|
|
|
* @param string $cell
|
|
|
|
* @param integer $xOffset
|
|
|
|
* @param integer $yOffset
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
2015-05-13 10:27:01 +00:00
|
|
|
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
|
2015-05-11 21:38:52 +00:00
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->topLeftCellRef = $cell;
|
2015-05-11 21:38:52 +00:00
|
|
|
if (!is_null($xOffset)) {
|
|
|
|
$this->setTopLeftXOffset($xOffset);
|
|
|
|
}
|
|
|
|
if (!is_null($yOffset)) {
|
|
|
|
$this->setTopLeftYOffset($yOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the top left position of the chart
|
|
|
|
*
|
|
|
|
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
|
|
|
|
*/
|
|
|
|
public function getTopLeftPosition()
|
|
|
|
{
|
|
|
|
return array(
|
2015-05-17 09:22:51 +00:00
|
|
|
'cell' => $this->topLeftCellRef,
|
|
|
|
'xOffset' => $this->topLeftXOffset,
|
|
|
|
'yOffset' => $this->topLeftYOffset
|
2015-05-11 21:38:52 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the cell address where the top left of the chart is fixed
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getTopLeftCell()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->topLeftCellRef;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Top Left cell position for the chart
|
|
|
|
*
|
|
|
|
* @param string $cell
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setTopLeftCell($cell)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->topLeftCellRef = $cell;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the offset position within the Top Left cell for the chart
|
|
|
|
*
|
|
|
|
* @param integer $xOffset
|
|
|
|
* @param integer $yOffset
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setTopLeftOffset($xOffset = null, $yOffset = null)
|
|
|
|
{
|
|
|
|
if (!is_null($xOffset)) {
|
|
|
|
$this->setTopLeftXOffset($xOffset);
|
|
|
|
}
|
|
|
|
if (!is_null($yOffset)) {
|
|
|
|
$this->setTopLeftYOffset($yOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the offset position within the Top Left cell for the chart
|
|
|
|
*
|
|
|
|
* @return integer[]
|
|
|
|
*/
|
|
|
|
public function getTopLeftOffset()
|
|
|
|
{
|
|
|
|
return array(
|
2015-05-17 09:22:51 +00:00
|
|
|
'X' => $this->topLeftXOffset,
|
|
|
|
'Y' => $this->topLeftYOffset
|
2015-05-11 21:38:52 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTopLeftXOffset($xOffset)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->topLeftXOffset = $xOffset;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTopLeftXOffset()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->topLeftXOffset;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setTopLeftYOffset($yOffset)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->topLeftYOffset = $yOffset;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTopLeftYOffset()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->topLeftYOffset;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Bottom Right position of the chart
|
|
|
|
*
|
|
|
|
* @param string $cell
|
|
|
|
* @param integer $xOffset
|
|
|
|
* @param integer $yOffset
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->bottomRightCellRef = $cell;
|
2015-05-11 21:38:52 +00:00
|
|
|
if (!is_null($xOffset)) {
|
|
|
|
$this->setBottomRightXOffset($xOffset);
|
|
|
|
}
|
|
|
|
if (!is_null($yOffset)) {
|
|
|
|
$this->setBottomRightYOffset($yOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the bottom right position of the chart
|
|
|
|
*
|
|
|
|
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
|
|
|
|
*/
|
|
|
|
public function getBottomRightPosition()
|
|
|
|
{
|
|
|
|
return array(
|
2015-05-17 09:22:51 +00:00
|
|
|
'cell' => $this->bottomRightCellRef,
|
|
|
|
'xOffset' => $this->bottomRightXOffset,
|
|
|
|
'yOffset' => $this->bottomRightYOffset
|
2015-05-11 21:38:52 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setBottomRightCell($cell)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->bottomRightCellRef = $cell;
|
2012-02-08 21:17:39 +00:00
|
|
|
|
2015-05-11 21:38:52 +00:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the cell address where the bottom right of the chart is fixed
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getBottomRightCell()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->bottomRightCellRef;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the offset position within the Bottom Right cell for the chart
|
|
|
|
*
|
|
|
|
* @param integer $xOffset
|
|
|
|
* @param integer $yOffset
|
|
|
|
* @return PHPExcel_Chart
|
|
|
|
*/
|
|
|
|
public function setBottomRightOffset($xOffset = null, $yOffset = null)
|
|
|
|
{
|
|
|
|
if (!is_null($xOffset)) {
|
|
|
|
$this->setBottomRightXOffset($xOffset);
|
|
|
|
}
|
|
|
|
if (!is_null($yOffset)) {
|
|
|
|
$this->setBottomRightYOffset($yOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the offset position within the Bottom Right cell for the chart
|
|
|
|
*
|
|
|
|
* @return integer[]
|
|
|
|
*/
|
|
|
|
public function getBottomRightOffset()
|
|
|
|
{
|
|
|
|
return array(
|
2015-05-17 09:22:51 +00:00
|
|
|
'X' => $this->bottomRightXOffset,
|
|
|
|
'Y' => $this->bottomRightYOffset
|
2015-05-11 21:38:52 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setBottomRightXOffset($xOffset)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->bottomRightXOffset = $xOffset;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getBottomRightXOffset()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->bottomRightXOffset;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setBottomRightYOffset($yOffset)
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
$this->bottomRightYOffset = $yOffset;
|
2015-05-11 21:38:52 +00:00
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getBottomRightYOffset()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
return $this->bottomRightYOffset;
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function refresh()
|
|
|
|
{
|
2015-05-17 09:22:51 +00:00
|
|
|
if ($this->worksheet !== null) {
|
|
|
|
$this->plotArea->refresh($this->worksheet);
|
2015-05-11 21:38:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render($outputDestination = null)
|
|
|
|
{
|
|
|
|
$libraryName = PHPExcel_Settings::getChartRendererName();
|
|
|
|
if (is_null($libraryName)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// Ensure that data series values are up-to-date before we render
|
|
|
|
$this->refresh();
|
|
|
|
|
|
|
|
$libraryPath = PHPExcel_Settings::getChartRendererPath();
|
2015-05-13 10:27:01 +00:00
|
|
|
$includePath = str_replace('\\', '/', get_include_path());
|
|
|
|
$rendererPath = str_replace('\\', '/', $libraryPath);
|
|
|
|
if (strpos($rendererPath, $includePath) === false) {
|
2015-05-11 21:38:52 +00:00
|
|
|
set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
$rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName;
|
|
|
|
$renderer = new $rendererName($this);
|
|
|
|
|
|
|
|
if ($outputDestination == 'php://output') {
|
|
|
|
$outputDestination = null;
|
|
|
|
}
|
|
|
|
return $renderer->render($outputDestination);
|
|
|
|
}
|
2012-02-08 21:17:39 +00:00
|
|
|
}
|