Subversion Repositories eFlore/Applications.cel

Compare Revisions

No changes between revisions

Ignore whitespace Rev 2909 → Rev 2910

/branches/v2.25-scarificateur/jrest/lib/PHPExcel/Classes/PHPExcel/Chart/DataSeries.php
New file
0,0 → 1,354
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* 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
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
 
 
/**
* PHPExcel_Chart_DataSeries
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_DataSeries
{
 
const TYPE_BARCHART = 'barChart';
const TYPE_BARCHART_3D = 'bar3DChart';
const TYPE_LINECHART = 'lineChart';
const TYPE_LINECHART_3D = 'line3DChart';
const TYPE_AREACHART = 'areaChart';
const TYPE_AREACHART_3D = 'area3DChart';
const TYPE_PIECHART = 'pieChart';
const TYPE_PIECHART_3D = 'pie3DChart';
const TYPE_DOUGHTNUTCHART = 'doughnutChart';
const TYPE_DONUTCHART = self::TYPE_DOUGHTNUTCHART; // Synonym
const TYPE_SCATTERCHART = 'scatterChart';
const TYPE_SURFACECHART = 'surfaceChart';
const TYPE_SURFACECHART_3D = 'surface3DChart';
const TYPE_RADARCHART = 'radarChart';
const TYPE_BUBBLECHART = 'bubbleChart';
const TYPE_STOCKCHART = 'stockChart';
 
const GROUPING_CLUSTERED = 'clustered';
const GROUPING_STACKED = 'stacked';
const GROUPING_PERCENT_STACKED = 'percentStacked';
const GROUPING_STANDARD = 'standard';
 
const DIRECTION_BAR = 'bar';
const DIRECTION_HORIZONTAL = self::DIRECTION_BAR;
const DIRECTION_COL = 'col';
const DIRECTION_COLUMN = self::DIRECTION_COL;
const DIRECTION_VERTICAL = self::DIRECTION_COL;
 
const STYLE_LINEMARKER = 'lineMarker';
const STYLE_SMOOTHMARKER = 'smoothMarker';
const STYLE_MARKER = 'marker';
const STYLE_FILLED = 'filled';
 
 
/**
* Series Plot Type
*
* @var string
*/
private $_plotType = null;
 
/**
* Plot Grouping Type
*
* @var boolean
*/
private $_plotGrouping = null;
 
/**
* Plot Direction
*
* @var boolean
*/
private $_plotDirection = null;
 
/**
* Plot Style
*
* @var string
*/
private $_plotStyle = null;
 
/**
* Order of plots in Series
*
* @var array of integer
*/
private $_plotOrder = array();
 
/**
* Plot Label
*
* @var array of PHPExcel_Chart_DataSeriesValues
*/
private $_plotLabel = array();
 
/**
* Plot Category
*
* @var array of PHPExcel_Chart_DataSeriesValues
*/
private $_plotCategory = array();
 
/**
* Smooth Line
*
* @var string
*/
private $_smoothLine = null;
 
/**
* Plot Values
*
* @var array of PHPExcel_Chart_DataSeriesValues
*/
private $_plotValues = array();
 
/**
* Create a new PHPExcel_Chart_DataSeries
*/
public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $smoothLine = null, $plotStyle = null)
{
$this->_plotType = $plotType;
$this->_plotGrouping = $plotGrouping;
$this->_plotOrder = $plotOrder;
$keys = array_keys($plotValues);
$this->_plotValues = $plotValues;
if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
$plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
}
 
$this->_plotLabel = $plotLabel;
if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
$plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
}
$this->_plotCategory = $plotCategory;
$this->_smoothLine = $smoothLine;
$this->_plotStyle = $plotStyle;
}
 
/**
* Get Plot Type
*
* @return string
*/
public function getPlotType() {
return $this->_plotType;
}
 
/**
* Set Plot Type
*
* @param string $plotType
*/
public function setPlotType($plotType = '') {
$this->_plotType = $plotType;
}
 
/**
* Get Plot Grouping Type
*
* @return string
*/
public function getPlotGrouping() {
return $this->_plotGrouping;
}
 
/**
* Set Plot Grouping Type
*
* @param string $groupingType
*/
public function setPlotGrouping($groupingType = null) {
$this->_plotGrouping = $groupingType;
}
 
/**
* Get Plot Direction
*
* @return string
*/
public function getPlotDirection() {
return $this->_plotDirection;
}
 
/**
* Set Plot Direction
*
* @param string $plotDirection
*/
public function setPlotDirection($plotDirection = null) {
$this->_plotDirection = $plotDirection;
}
 
/**
* Get Plot Order
*
* @return string
*/
public function getPlotOrder() {
return $this->_plotOrder;
}
 
/**
* Get Plot Labels
*
* @return array of PHPExcel_Chart_DataSeriesValues
*/
public function getPlotLabels() {
return $this->_plotLabel;
}
 
/**
* Get Plot Label by Index
*
* @return PHPExcel_Chart_DataSeriesValues
*/
public function getPlotLabelByIndex($index) {
$keys = array_keys($this->_plotLabel);
if (in_array($index,$keys)) {
return $this->_plotLabel[$index];
} elseif(isset($keys[$index])) {
return $this->_plotLabel[$keys[$index]];
}
return false;
}
 
/**
* Get Plot Categories
*
* @return array of PHPExcel_Chart_DataSeriesValues
*/
public function getPlotCategories() {
return $this->_plotCategory;
}
 
/**
* Get Plot Category by Index
*
* @return PHPExcel_Chart_DataSeriesValues
*/
public function getPlotCategoryByIndex($index) {
$keys = array_keys($this->_plotCategory);
if (in_array($index,$keys)) {
return $this->_plotCategory[$index];
} elseif(isset($keys[$index])) {
return $this->_plotCategory[$keys[$index]];
}
return false;
}
 
/**
* Get Plot Style
*
* @return string
*/
public function getPlotStyle() {
return $this->_plotStyle;
}
 
/**
* Set Plot Style
*
* @param string $plotStyle
*/
public function setPlotStyle($plotStyle = null) {
$this->_plotStyle = $plotStyle;
}
 
/**
* Get Plot Values
*
* @return array of PHPExcel_Chart_DataSeriesValues
*/
public function getPlotValues() {
return $this->_plotValues;
}
 
/**
* Get Plot Values by Index
*
* @return PHPExcel_Chart_DataSeriesValues
*/
public function getPlotValuesByIndex($index) {
$keys = array_keys($this->_plotValues);
if (in_array($index,$keys)) {
return $this->_plotValues[$index];
} elseif(isset($keys[$index])) {
return $this->_plotValues[$keys[$index]];
}
return false;
}
 
/**
* Get Number of Plot Series
*
* @return integer
*/
public function getPlotSeriesCount() {
return count($this->_plotValues);
}
 
/**
* Get Smooth Line
*
* @return boolean
*/
public function getSmoothLine() {
return $this->_smoothLine;
}
 
/**
* Set Smooth Line
*
* @param boolean $smoothLine
*/
public function setSmoothLine($smoothLine = TRUE) {
$this->_smoothLine = $smoothLine;
}
 
public function refresh(PHPExcel_Worksheet $worksheet) {
foreach($this->_plotValues as $plotValues) {
if ($plotValues !== NULL)
$plotValues->refresh($worksheet, TRUE);
}
foreach($this->_plotLabel as $plotValues) {
if ($plotValues !== NULL)
$plotValues->refresh($worksheet, TRUE);
}
foreach($this->_plotCategory as $plotValues) {
if ($plotValues !== NULL)
$plotValues->refresh($worksheet, FALSE);
}
}
 
}
/branches/v2.25-scarificateur/jrest/lib/PHPExcel/Classes/PHPExcel/Chart/DataSeriesValues.php
New file
0,0 → 1,327
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* 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
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
 
 
/**
* PHPExcel_Chart_DataSeriesValues
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_DataSeriesValues
{
 
const DATASERIES_TYPE_STRING = 'String';
const DATASERIES_TYPE_NUMBER = 'Number';
 
private static $_dataTypeValues = array(
self::DATASERIES_TYPE_STRING,
self::DATASERIES_TYPE_NUMBER,
);
 
/**
* Series Data Type
*
* @var string
*/
private $_dataType = null;
 
/**
* Series Data Source
*
* @var string
*/
private $_dataSource = null;
 
/**
* Format Code
*
* @var string
*/
private $_formatCode = null;
 
/**
* Series Point Marker
*
* @var string
*/
private $_marker = null;
 
/**
* Point Count (The number of datapoints in the dataseries)
*
* @var integer
*/
private $_pointCount = 0;
 
/**
* Data Values
*
* @var array of mixed
*/
private $_dataValues = array();
 
/**
* Create a new PHPExcel_Chart_DataSeriesValues object
*/
public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null)
{
$this->setDataType($dataType);
$this->_dataSource = $dataSource;
$this->_formatCode = $formatCode;
$this->_pointCount = $pointCount;
$this->_dataValues = $dataValues;
$this->_marker = $marker;
}
 
/**
* Get Series Data Type
*
* @return string
*/
public function getDataType() {
return $this->_dataType;
}
 
/**
* Set Series Data Type
*
* @param string $dataType Datatype of this data series
* Typical values are:
* PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING
* Normally used for axis point values
* PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER
* Normally used for chart data values
* @return PHPExcel_Chart_DataSeriesValues
*/
public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) {
if (!in_array($dataType, self::$_dataTypeValues)) {
throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values');
}
$this->_dataType = $dataType;
 
return $this;
}
 
/**
* Get Series Data Source (formula)
*
* @return string
*/
public function getDataSource() {
return $this->_dataSource;
}
 
/**
* Set Series Data Source (formula)
*
* @param string $dataSource
* @return PHPExcel_Chart_DataSeriesValues
*/
public function setDataSource($dataSource = null, $refreshDataValues = true) {
$this->_dataSource = $dataSource;
 
if ($refreshDataValues) {
// TO DO
}
 
return $this;
}
 
/**
* Get Point Marker
*
* @return string
*/
public function getPointMarker() {
return $this->_marker;
}
 
/**
* Set Point Marker
*
* @param string $marker
* @return PHPExcel_Chart_DataSeriesValues
*/
public function setPointMarker($marker = null) {
$this->_marker = $marker;
 
return $this;
}
 
/**
* Get Series Format Code
*
* @return string
*/
public function getFormatCode() {
return $this->_formatCode;
}
 
/**
* Set Series Format Code
*
* @param string $formatCode
* @return PHPExcel_Chart_DataSeriesValues
*/
public function setFormatCode($formatCode = null) {
$this->_formatCode = $formatCode;
 
return $this;
}
 
/**
* Get Series Point Count
*
* @return integer
*/
public function getPointCount() {
return $this->_pointCount;
}
 
/**
* Identify if the Data Series is a multi-level or a simple series
*
* @return boolean
*/
public function isMultiLevelSeries() {
if (count($this->_dataValues) > 0) {
return is_array($this->_dataValues[0]);
}
return null;
}
 
/**
* Return the level count of a multi-level Data Series
*
* @return boolean
*/
public function multiLevelCount() {
$levelCount = 0;
foreach($this->_dataValues as $dataValueSet) {
$levelCount = max($levelCount,count($dataValueSet));
}
return $levelCount;
}
 
/**
* Get Series Data Values
*
* @return array of mixed
*/
public function getDataValues() {
return $this->_dataValues;
}
 
/**
* Get the first Series Data value
*
* @return mixed
*/
public function getDataValue() {
$count = count($this->_dataValues);
if ($count == 0) {
return null;
} elseif ($count == 1) {
return $this->_dataValues[0];
}
return $this->_dataValues;
}
 
/**
* Set Series Data Values
*
* @param array $dataValues
* @param boolean $refreshDataSource
* TRUE - refresh the value of _dataSource based on the values of $dataValues
* FALSE - don't change the value of _dataSource
* @return PHPExcel_Chart_DataSeriesValues
*/
public function setDataValues($dataValues = array(), $refreshDataSource = TRUE) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
$this->_pointCount = count($dataValues);
 
if ($refreshDataSource) {
// TO DO
}
 
return $this;
}
 
private function _stripNulls($var) {
return $var !== NULL;
}
 
public function refresh(PHPExcel_Worksheet $worksheet, $flatten = TRUE) {
if ($this->_dataSource !== NULL) {
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
$newDataValues = PHPExcel_Calculation::_unwrapResult(
$calcEngine->_calculateFormulaValue(
'='.$this->_dataSource,
NULL,
$worksheet->getCell('A1')
)
);
if ($flatten) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
foreach($this->_dataValues as &$dataValue) {
if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
$dataValue = 0.0;
}
}
unset($dataValue);
} else {
$cellRange = explode('!',$this->_dataSource);
if (count($cellRange) > 1) {
list(,$cellRange) = $cellRange;
}
 
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','',$cellRange));
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
} else {
$newArray = array_values(array_shift($newDataValues));
foreach($newArray as $i => $newDataSet) {
$newArray[$i] = array($newDataSet);
}
 
foreach($newDataValues as $newDataSet) {
$i = 0;
foreach($newDataSet as $newDataVal) {
array_unshift($newArray[$i++],$newDataVal);
}
}
$this->_dataValues = $newArray;
}
}
$this->_pointCount = count($this->_dataValues);
}
 
}
 
}
/branches/v2.25-scarificateur/jrest/lib/PHPExcel/Classes/PHPExcel/Chart/PlotArea.php
New file
0,0 → 1,125
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* 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
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
 
 
/**
* PHPExcel_Chart_PlotArea
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_PlotArea
{
/**
* PlotArea Layout
*
* @var PHPExcel_Chart_Layout
*/
private $_layout = null;
 
/**
* Plot Series
*
* @var array of PHPExcel_Chart_DataSeries
*/
private $_plotSeries = array();
 
/**
* Create a new PHPExcel_Chart_PlotArea
*/
public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
{
$this->_layout = $layout;
$this->_plotSeries = $plotSeries;
}
 
/**
* Get Layout
*
* @return PHPExcel_Chart_Layout
*/
public function getLayout() {
return $this->_layout;
}
 
/**
* Get Number of Plot Groups
*
* @return array of PHPExcel_Chart_DataSeries
*/
public function getPlotGroupCount() {
return count($this->_plotSeries);
}
 
/**
* Get Number of Plot Series
*
* @return integer
*/
public function getPlotSeriesCount() {
$seriesCount = 0;
foreach($this->_plotSeries as $plot) {
$seriesCount += $plot->getPlotSeriesCount();
}
return $seriesCount;
}
 
/**
* Get Plot Series
*
* @return array of PHPExcel_Chart_DataSeries
*/
public function getPlotGroup() {
return $this->_plotSeries;
}
 
/**
* Get Plot Series by Index
*
* @return PHPExcel_Chart_DataSeries
*/
public function getPlotGroupByIndex($index) {
return $this->_plotSeries[$index];
}
 
/**
* Set Plot Series
*
* @param [PHPExcel_Chart_DataSeries]
*/
public function setPlotSeries($plotSeries = array()) {
$this->_plotSeries = $plotSeries;
}
 
public function refresh(PHPExcel_Worksheet $worksheet) {
foreach($this->_plotSeries as $plotSeries) {
$plotSeries->refresh($worksheet);
}
}
 
}
/branches/v2.25-scarificateur/jrest/lib/PHPExcel/Classes/PHPExcel/Chart/Layout.php
New file
0,0 → 1,417
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* 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
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
 
 
/**
* PHPExcel_Chart_Layout
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Layout
{
/**
* layoutTarget
*
* @var string
*/
private $_layoutTarget = NULL;
 
/**
* X Mode
*
* @var string
*/
private $_xMode = NULL;
 
/**
* Y Mode
*
* @var string
*/
private $_yMode = NULL;
 
/**
* X-Position
*
* @var float
*/
private $_xPos = NULL;
 
/**
* Y-Position
*
* @var float
*/
private $_yPos = NULL;
 
/**
* width
*
* @var float
*/
private $_width = NULL;
 
/**
* height
*
* @var float
*/
private $_height = NULL;
 
/**
* show legend key
* Specifies that legend keys should be shown in data labels
*
* @var boolean
*/
private $_showLegendKey = NULL;
 
/**
* show value
* Specifies that the value should be shown in a data label.
*
* @var boolean
*/
private $_showVal = NULL;
 
/**
* show category name
* Specifies that the category name should be shown in the data label.
*
* @var boolean
*/
private $_showCatName = NULL;
 
/**
* show data series name
* Specifies that the series name should be shown in the data label.
*
* @var boolean
*/
private $_showSerName = NULL;
 
/**
* show percentage
* Specifies that the percentage should be shown in the data label.
*
* @var boolean
*/
private $_showPercent = NULL;
 
/**
* show bubble size
*
* @var boolean
*/
private $_showBubbleSize = NULL;
 
/**
* show leader lines
* Specifies that leader lines should be shown for the data label.
*
* @var boolean
*/
private $_showLeaderLines = NULL;
 
 
/**
* Create a new PHPExcel_Chart_Layout
*/
public function __construct($layout=array())
{
if (isset($layout['layoutTarget'])) { $this->_layoutTarget = $layout['layoutTarget']; }
if (isset($layout['xMode'])) { $this->_xMode = $layout['xMode']; }
if (isset($layout['yMode'])) { $this->_yMode = $layout['yMode']; }
if (isset($layout['x'])) { $this->_xPos = (float) $layout['x']; }
if (isset($layout['y'])) { $this->_yPos = (float) $layout['y']; }
if (isset($layout['w'])) { $this->_width = (float) $layout['w']; }
if (isset($layout['h'])) { $this->_height = (float) $layout['h']; }
}
 
/**
* Get Layout Target
*
* @return string
*/
public function getLayoutTarget() {
return $this->_layoutTarget;
}
 
/**
* Set Layout Target
*
* @param Layout Target $value
*/
public function setLayoutTarget($value) {
$this->_layoutTarget = $value;
}
 
/**
* Get X-Mode
*
* @return string
*/
public function getXMode() {
return $this->_xMode;
}
 
/**
* Set X-Mode
*
* @param X-Mode $value
*/
public function setXMode($value) {
$this->_xMode = $value;
}
 
/**
* Get Y-Mode
*
* @return string
*/
public function getYMode() {
return $this->_xMode;
}
 
/**
* Set Y-Mode
*
* @param Y-Mode $value
*/
public function setYMode($value) {
$this->_xMode = $value;
}
 
/**
* Get X-Position
*
* @return number
*/
public function getXPosition() {
return $this->_xPos;
}
 
/**
* Set X-Position
*
* @param X-Position $value
*/
public function setXPosition($value) {
$this->_xPos = $value;
}
 
/**
* Get Y-Position
*
* @return number
*/
public function getYPosition() {
return $this->_yPos;
}
 
/**
* Set Y-Position
*
* @param Y-Position $value
*/
public function setYPosition($value) {
$this->_yPos = $value;
}
 
/**
* Get Width
*
* @return number
*/
public function getWidth() {
return $this->_width;
}
 
/**
* Set Width
*
* @param Width $value
*/
public function setWidth($value) {
$this->_width = $value;
}
 
/**
* Get Height
*
* @return number
*/
public function getHeight() {
return $this->_height;
}
 
/**
* Set Height
*
* @param Height $value
*/
public function setHeight($value) {
$this->_height = $value;
}
 
 
/**
* Get show legend key
*
* @return boolean
*/
public function getShowLegendKey() {
return $this->_showLegendKey;
}
 
/**
* Set show legend key
* Specifies that legend keys should be shown in data labels.
*
* @param boolean $value Show legend key
*/
public function setShowLegendKey($value) {
$this->_showLegendKey = $value;
}
 
/**
* Get show value
*
* @return boolean
*/
public function getShowVal() {
return $this->_showVal;
}
 
/**
* Set show val
* Specifies that the value should be shown in data labels.
*
* @param boolean $value Show val
*/
public function setShowVal($value) {
$this->_showVal = $value;
}
 
/**
* Get show category name
*
* @return boolean
*/
public function getShowCatName() {
return $this->_showCatName;
}
 
/**
* Set show cat name
* Specifies that the category name should be shown in data labels.
*
* @param boolean $value Show cat name
*/
public function setShowCatName($value) {
$this->_showCatName = $value;
}
 
/**
* Get show data series name
*
* @return boolean
*/
public function getShowSerName() {
return $this->_showSerName;
}
 
/**
* Set show ser name
* Specifies that the series name should be shown in data labels.
*
* @param boolean $value Show ser name
*/
public function setShowSerName($value) {
$this->_showSerName = $value;
}
 
/**
* Get show percentage
*
* @return boolean
*/
public function getShowPercent() {
return $this->_showPercent;
}
 
/**
* Set show percentage
* Specifies that the percentage should be shown in data labels.
*
* @param boolean $value Show percentage
*/
public function setShowPercent($value) {
$this->_showPercent = $value;
}
 
/**
* Get show bubble size
*
* @return boolean
*/
public function getShowBubbleSize() {
return $this->_showBubbleSize;
}
 
/**
* Set show bubble size
* Specifies that the bubble size should be shown in data labels.
*
* @param boolean $value Show bubble size
*/
public function setShowBubbleSize($value) {
$this->_showBubbleSize = $value;
}
 
/**
* Get show leader lines
*
* @return boolean
*/
public function getShowLeaderLines() {
return $this->_showLeaderLines;
}
 
/**
* Set show leader lines
* Specifies that leader lines should be shown in data labels.
*
* @param boolean $value Show leader lines
*/
public function setShowLeaderLines($value) {
$this->_showLeaderLines = $value;
}
 
}
/branches/v2.25-scarificateur/jrest/lib/PHPExcel/Classes/PHPExcel/Chart/Exception.php
New file
0,0 → 1,52
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* 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
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
 
 
/**
* PHPExcel_Chart_Exception
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Exception extends PHPExcel_Exception {
/**
* Error handler callback
*
* @param mixed $code
* @param mixed $string
* @param mixed $file
* @param mixed $line
* @param mixed $context
*/
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
$e = new self($string, $code);
$e->line = $line;
$e->file = $file;
throw $e;
}
}
/branches/v2.25-scarificateur/jrest/lib/PHPExcel/Classes/PHPExcel/Chart/Legend.php
New file
0,0 → 1,171
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* 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
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
 
 
/**
* PHPExcel_Chart_Legend
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
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;
}
 
}
/branches/v2.25-scarificateur/jrest/lib/PHPExcel/Classes/PHPExcel/Chart/Renderer/jpgraph.php
New file
0,0 → 1,837
<?php
 
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* 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
*
* @category PHPExcel
* @package PHPExcel_Chart_Renderer
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
 
 
require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
 
 
/**
* PHPExcel_Chart_Renderer_jpgraph
*
* @category PHPExcel
* @package PHPExcel_Chart_Renderer
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Renderer_jpgraph
{
private static $_width = 640;
 
private static $_height = 480;
 
private static $_colourSet = array( 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1',
'darkmagenta', 'coral', 'dodgerblue3', 'eggplant',
'mediumblue', 'magenta', 'sandybrown', 'cyan',
'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen',
'goldenrod2'
);
 
private static $_markSet = array( 'diamond' => MARK_DIAMOND,
'square' => MARK_SQUARE,
'triangle' => MARK_UTRIANGLE,
'x' => MARK_X,
'star' => MARK_STAR,
'dot' => MARK_FILLEDCIRCLE,
'dash' => MARK_DTRIANGLE,
'circle' => MARK_CIRCLE,
'plus' => MARK_CROSS
);
 
 
private $_chart = null;
 
private $_graph = null;
 
private static $_plotColour = 0;
 
private static $_plotMark = 0;
 
 
private function _formatPointMarker($seriesPlot,$markerID) {
$plotMarkKeys = array_keys(self::$_markSet);
if (is_null($markerID)) {
// Use default plot marker (next marker in the series)
self::$_plotMark %= count(self::$_markSet);
$seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]);
} elseif ($markerID !== 'none') {
// Use specified plot marker (if it exists)
if (isset(self::$_markSet[$markerID])) {
$seriesPlot->mark->SetType(self::$_markSet[$markerID]);
} else {
// If the specified plot marker doesn't exist, use default plot marker (next marker in the series)
self::$_plotMark %= count(self::$_markSet);
$seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]);
}
} else {
// Hide plot marker
$seriesPlot->mark->Hide();
}
$seriesPlot->mark->SetColor(self::$_colourSet[self::$_plotColour]);
$seriesPlot->mark->SetFillColor(self::$_colourSet[self::$_plotColour]);
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
 
return $seriesPlot;
} // function _formatPointMarker()
 
 
private function _formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '') {
$datasetLabelFormatCode = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode();
if (!is_null($datasetLabelFormatCode)) {
// Retrieve any label formatting code
$datasetLabelFormatCode = stripslashes($datasetLabelFormatCode);
}
 
$testCurrentIndex = 0;
foreach($datasetLabels as $i => $datasetLabel) {
if (is_array($datasetLabel)) {
if ($rotation == 'bar') {
$datasetLabels[$i] = implode(" ",$datasetLabel);
} else {
$datasetLabel = array_reverse($datasetLabel);
$datasetLabels[$i] = implode("\n",$datasetLabel);
}
} else {
// Format labels according to any formatting code
if (!is_null($datasetLabelFormatCode)) {
$datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel,$datasetLabelFormatCode);
}
}
++$testCurrentIndex;
}
 
return $datasetLabels;
} // function _formatDataSetLabels()
 
 
private function _percentageSumCalculation($groupID,$seriesCount) {
// Adjust our values to a percentage value across all series in the group
for($i = 0; $i < $seriesCount; ++$i) {
if ($i == 0) {
$sumValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
} else {
$nextValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
foreach($nextValues as $k => $value) {
if (isset($sumValues[$k])) {
$sumValues[$k] += $value;
} else {
$sumValues[$k] = $value;
}
}
}
}
 
return $sumValues;
} // function _percentageSumCalculation()
 
 
private function _percentageAdjustValues($dataValues,$sumValues) {
foreach($dataValues as $k => $dataValue) {
$dataValues[$k] = $dataValue / $sumValues[$k] * 100;
}
 
return $dataValues;
} // function _percentageAdjustValues()
 
 
private function _getCaption($captionElement) {
// Read any caption
$caption = (!is_null($captionElement)) ? $captionElement->getCaption() : NULL;
// Test if we have a title caption to display
if (!is_null($caption)) {
// If we do, it could be a plain string or an array
if (is_array($caption)) {
// Implode an array to a plain string
$caption = implode('',$caption);
}
}
return $caption;
} // function _getCaption()
 
 
private function _renderTitle() {
$title = $this->_getCaption($this->_chart->getTitle());
if (!is_null($title)) {
$this->_graph->title->Set($title);
}
} // function _renderTitle()
 
 
private function _renderLegend() {
$legend = $this->_chart->getLegend();
if (!is_null($legend)) {
$legendPosition = $legend->getPosition();
$legendOverlay = $legend->getOverlay();
switch ($legendPosition) {
case 'r' :
$this->_graph->legend->SetPos(0.01,0.5,'right','center'); // right
$this->_graph->legend->SetColumns(1);
break;
case 'l' :
$this->_graph->legend->SetPos(0.01,0.5,'left','center'); // left
$this->_graph->legend->SetColumns(1);
break;
case 't' :
$this->_graph->legend->SetPos(0.5,0.01,'center','top'); // top
break;
case 'b' :
$this->_graph->legend->SetPos(0.5,0.99,'center','bottom'); // bottom
break;
default :
$this->_graph->legend->SetPos(0.01,0.01,'right','top'); // top-right
$this->_graph->legend->SetColumns(1);
break;
}
} else {
$this->_graph->legend->Hide();
}
} // function _renderLegend()
 
 
private function _renderCartesianPlotArea($type='textlin') {
$this->_graph = new Graph(self::$_width,self::$_height);
$this->_graph->SetScale($type);
 
$this->_renderTitle();
 
// Rotate for bar rather than column chart
$rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection();
$reverse = ($rotation == 'bar') ? true : false;
 
$xAxisLabel = $this->_chart->getXAxisLabel();
if (!is_null($xAxisLabel)) {
$title = $this->_getCaption($xAxisLabel);
if (!is_null($title)) {
$this->_graph->xaxis->SetTitle($title,'center');
$this->_graph->xaxis->title->SetMargin(35);
if ($reverse) {
$this->_graph->xaxis->title->SetAngle(90);
$this->_graph->xaxis->title->SetMargin(90);
}
}
}
 
$yAxisLabel = $this->_chart->getYAxisLabel();
if (!is_null($yAxisLabel)) {
$title = $this->_getCaption($yAxisLabel);
if (!is_null($title)) {
$this->_graph->yaxis->SetTitle($title,'center');
if ($reverse) {
$this->_graph->yaxis->title->SetAngle(0);
$this->_graph->yaxis->title->SetMargin(-55);
}
}
}
} // function _renderCartesianPlotArea()
 
 
private function _renderPiePlotArea($doughnut = False) {
$this->_graph = new PieGraph(self::$_width,self::$_height);
 
$this->_renderTitle();
} // function _renderPiePlotArea()
 
 
private function _renderRadarPlotArea() {
$this->_graph = new RadarGraph(self::$_width,self::$_height);
$this->_graph->SetScale('lin');
 
$this->_renderTitle();
} // function _renderRadarPlotArea()
 
 
private function _renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
 
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
$this->_graph->xaxis->SetTickLabels($datasetLabels);
}
 
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
if ($grouping == 'percentStacked') {
$sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
}
 
// Loop through each data series in turn
for($i = 0; $i < $seriesCount; ++$i) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
 
if ($grouping == 'percentStacked') {
$dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
}
 
// Fill in any missing values in the $dataValues array
$testCurrentIndex = 0;
foreach($dataValues as $k => $dataValue) {
while($k != $testCurrentIndex) {
$dataValues[$testCurrentIndex] = null;
++$testCurrentIndex;
}
++$testCurrentIndex;
}
 
$seriesPlot = new LinePlot($dataValues);
if ($combination) {
$seriesPlot->SetBarCenter();
}
 
if ($filled) {
$seriesPlot->SetFilled(true);
$seriesPlot->SetColor('black');
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
} else {
// Set the appropriate plot marker
$this->_formatPointMarker($seriesPlot,$marker);
}
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetLegend($dataLabel);
 
$seriesPlots[] = $seriesPlot;
}
 
if ($grouping == 'standard') {
$groupPlot = $seriesPlots;
} else {
$groupPlot = new AccLinePlot($seriesPlots);
}
$this->_graph->Add($groupPlot);
} // function _renderPlotLine()
 
 
private function _renderPlotBar($groupID, $dimensions = '2d') {
$rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
// Rotate for bar rather than column chart
if (($groupID == 0) && ($rotation == 'bar')) {
$this->_graph->Set90AndMargin();
}
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
 
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation);
// Rotate for bar rather than column chart
if ($rotation == 'bar') {
$datasetLabels = array_reverse($datasetLabels);
$this->_graph->yaxis->SetPos('max');
$this->_graph->yaxis->SetLabelAlign('center','top');
$this->_graph->yaxis->SetLabelSide(SIDE_RIGHT);
}
$this->_graph->xaxis->SetTickLabels($datasetLabels);
}
 
 
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
if ($grouping == 'percentStacked') {
$sumValues = $this->_percentageSumCalculation($groupID,$seriesCount);
}
 
// Loop through each data series in turn
for($j = 0; $j < $seriesCount; ++$j) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
if ($grouping == 'percentStacked') {
$dataValues = $this->_percentageAdjustValues($dataValues,$sumValues);
}
 
// Fill in any missing values in the $dataValues array
$testCurrentIndex = 0;
foreach($dataValues as $k => $dataValue) {
while($k != $testCurrentIndex) {
$dataValues[$testCurrentIndex] = null;
++$testCurrentIndex;
}
++$testCurrentIndex;
}
 
// Reverse the $dataValues order for bar rather than column chart
if ($rotation == 'bar') {
$dataValues = array_reverse($dataValues);
}
$seriesPlot = new BarPlot($dataValues);
$seriesPlot->SetColor('black');
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
if ($dimensions == '3d') {
$seriesPlot->SetShadow();
}
if (!$this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) {
$dataLabel = '';
} else {
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue();
}
$seriesPlot->SetLegend($dataLabel);
 
$seriesPlots[] = $seriesPlot;
}
// Reverse the plot order for bar rather than column chart
if (($rotation == 'bar') && (!($grouping == 'percentStacked'))) {
$seriesPlots = array_reverse($seriesPlots);
}
 
if ($grouping == 'clustered') {
$groupPlot = new GroupBarPlot($seriesPlots);
} elseif ($grouping == 'standard') {
$groupPlot = new GroupBarPlot($seriesPlots);
} else {
$groupPlot = new AccBarPlot($seriesPlots);
if ($dimensions == '3d') {
$groupPlot->SetShadow();
}
}
 
$this->_graph->Add($groupPlot);
} // function _renderPlotBar()
 
 
private function _renderPlotScatter($groupID,$bubble) {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
 
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
 
// Loop through each data series in turn
for($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
 
foreach($dataValuesY as $k => $dataValueY) {
$dataValuesY[$k] = $k;
}
 
$seriesPlot = new ScatterPlot($dataValuesX,$dataValuesY);
if ($scatterStyle == 'lineMarker') {
$seriesPlot->SetLinkPoints();
$seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]);
} elseif ($scatterStyle == 'smoothMarker') {
$spline = new Spline($dataValuesY,$dataValuesX);
list($splineDataY,$splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20);
$lplot = new LinePlot($splineDataX,$splineDataY);
$lplot->SetColor(self::$_colourSet[self::$_plotColour]);
 
$this->_graph->Add($lplot);
}
 
if ($bubble) {
$this->_formatPointMarker($seriesPlot,'dot');
$seriesPlot->mark->SetColor('black');
$seriesPlot->mark->SetSize($bubbleSize);
} else {
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
$this->_formatPointMarker($seriesPlot,$marker);
}
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetLegend($dataLabel);
 
$this->_graph->Add($seriesPlot);
}
} // function _renderPlotScatter()
 
 
private function _renderPlotRadar($groupID) {
$radarStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
 
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
 
// Loop through each data series in turn
for($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
 
$dataValues = array();
foreach($dataValuesY as $k => $dataValueY) {
$dataValues[$k] = implode(' ',array_reverse($dataValueY));
}
$tmp = array_shift($dataValues);
$dataValues[] = $tmp;
$tmp = array_shift($dataValuesX);
$dataValuesX[] = $tmp;
 
$this->_graph->SetTitles(array_reverse($dataValues));
 
$seriesPlot = new RadarPlot(array_reverse($dataValuesX));
 
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
if ($radarStyle == 'filled') {
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour]);
}
$this->_formatPointMarker($seriesPlot,$marker);
$seriesPlot->SetLegend($dataLabel);
 
$this->_graph->Add($seriesPlot);
}
} // function _renderPlotRadar()
 
 
private function _renderPlotContour($groupID) {
$contourStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
 
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
 
$dataValues = array();
// Loop through each data series in turn
for($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
 
$dataValues[$i] = $dataValuesX;
}
$seriesPlot = new ContourPlot($dataValues);
 
$this->_graph->Add($seriesPlot);
} // function _renderPlotContour()
 
 
private function _renderPlotStock($groupID) {
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
$seriesPlots = array();
 
$dataValues = array();
// Loop through each data series in turn
for($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
 
foreach($dataValuesX as $j => $dataValueX)
$dataValues[$j][$plotOrder[$i]] = $dataValueX;
}
 
$seriesPlot = new StockPlot($dataValues);
 
$this->_graph->Add($seriesPlot);
} // function _renderPlotStock()
 
 
private function _renderAreaChart($groupCount, $dimensions = '2d') {
require_once('jpgraph_line.php');
 
$this->_renderCartesianPlotArea();
 
for($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotLine($i,True,False,$dimensions);
}
} // function _renderAreaChart()
 
 
private function _renderLineChart($groupCount, $dimensions = '2d') {
require_once('jpgraph_line.php');
 
$this->_renderCartesianPlotArea();
 
for($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotLine($i,False,False,$dimensions);
}
} // function _renderLineChart()
 
 
private function _renderBarChart($groupCount, $dimensions = '2d') {
require_once('jpgraph_bar.php');
 
$this->_renderCartesianPlotArea();
 
for($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotBar($i,$dimensions);
}
} // function _renderBarChart()
 
 
private function _renderScatterChart($groupCount) {
require_once('jpgraph_scatter.php');
require_once('jpgraph_regstat.php');
require_once('jpgraph_line.php');
 
$this->_renderCartesianPlotArea('linlin');
 
for($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotScatter($i,false);
}
} // function _renderScatterChart()
 
 
private function _renderBubbleChart($groupCount) {
require_once('jpgraph_scatter.php');
 
$this->_renderCartesianPlotArea('linlin');
 
for($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotScatter($i,true);
}
} // function _renderBubbleChart()
 
 
private function _renderPieChart($groupCount, $dimensions = '2d', $doughnut = False, $multiplePlots = False) {
require_once('jpgraph_pie.php');
if ($dimensions == '3d') {
require_once('jpgraph_pie3d.php');
}
 
$this->_renderPiePlotArea($doughnut);
 
$iLimit = ($multiplePlots) ? $groupCount : 1;
for($groupID = 0; $groupID < $iLimit; ++$groupID) {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
if ($groupID == 0) {
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
}
}
 
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
// For pie charts, we only display the first series: doughnut charts generally display all series
$jLimit = ($multiplePlots) ? $seriesCount : 1;
// Loop through each data series in turn
for($j = 0; $j < $jLimit; ++$j) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
 
// Fill in any missing values in the $dataValues array
$testCurrentIndex = 0;
foreach($dataValues as $k => $dataValue) {
while($k != $testCurrentIndex) {
$dataValues[$testCurrentIndex] = null;
++$testCurrentIndex;
}
++$testCurrentIndex;
}
 
if ($dimensions == '3d') {
$seriesPlot = new PiePlot3D($dataValues);
} else {
if ($doughnut) {
$seriesPlot = new PiePlotC($dataValues);
} else {
$seriesPlot = new PiePlot($dataValues);
}
}
 
if ($multiplePlots) {
$seriesPlot->SetSize(($jLimit-$j) / ($jLimit * 4));
}
 
if ($doughnut) {
$seriesPlot->SetMidColor('white');
}
 
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
if (count($datasetLabels) > 0)
$seriesPlot->SetLabels(array_fill(0,count($datasetLabels),''));
if ($dimensions != '3d') {
$seriesPlot->SetGuideLines(false);
}
if ($j == 0) {
if ($exploded) {
$seriesPlot->ExplodeAll();
}
$seriesPlot->SetLegends($datasetLabels);
}
 
$this->_graph->Add($seriesPlot);
}
}
} // function _renderPieChart()
 
 
private function _renderRadarChart($groupCount) {
require_once('jpgraph_radar.php');
 
$this->_renderRadarPlotArea();
 
for($groupID = 0; $groupID < $groupCount; ++$groupID) {
$this->_renderPlotRadar($groupID);
}
} // function _renderRadarChart()
 
 
private function _renderStockChart($groupCount) {
require_once('jpgraph_stock.php');
 
$this->_renderCartesianPlotArea();
 
for($groupID = 0; $groupID < $groupCount; ++$i) {
$this->_renderPlotStock($groupID);
}
} // function _renderStockChart()
 
 
private function _renderContourChart($groupCount,$dimensions) {
require_once('jpgraph_contour.php');
 
$this->_renderCartesianPlotArea('intint');
 
for($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotContour($i);
}
} // function _renderContourChart()
 
 
private function _renderCombinationChart($groupCount,$dimensions,$outputDestination) {
require_once('jpgraph_line.php');
require_once('jpgraph_bar.php');
require_once('jpgraph_scatter.php');
require_once('jpgraph_regstat.php');
require_once('jpgraph_line.php');
 
$this->_renderCartesianPlotArea();
 
for($i = 0; $i < $groupCount; ++$i) {
$dimensions = null;
$chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
switch ($chartType) {
case 'area3DChart' :
$dimensions = '3d';
case 'areaChart' :
$this->_renderPlotLine($i,True,True,$dimensions);
break;
case 'bar3DChart' :
$dimensions = '3d';
case 'barChart' :
$this->_renderPlotBar($i,$dimensions);
break;
case 'line3DChart' :
$dimensions = '3d';
case 'lineChart' :
$this->_renderPlotLine($i,False,True,$dimensions);
break;
case 'scatterChart' :
$this->_renderPlotScatter($i,false);
break;
case 'bubbleChart' :
$this->_renderPlotScatter($i,true);
break;
default :
$this->_graph = null;
return false;
}
}
 
$this->_renderLegend();
 
$this->_graph->Stroke($outputDestination);
return true;
} // function _renderCombinationChart()
 
 
public function render($outputDestination) {
self::$_plotColour = 0;
 
$groupCount = $this->_chart->getPlotArea()->getPlotGroupCount();
 
$dimensions = null;
if ($groupCount == 1) {
$chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
} else {
$chartTypes = array();
for($i = 0; $i < $groupCount; ++$i) {
$chartTypes[] = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
}
$chartTypes = array_unique($chartTypes);
if (count($chartTypes) == 1) {
$chartType = array_pop($chartTypes);
} elseif (count($chartTypes) == 0) {
echo 'Chart is not yet implemented<br />';
return false;
} else {
return $this->_renderCombinationChart($groupCount,$dimensions,$outputDestination);
}
}
 
switch ($chartType) {
case 'area3DChart' :
$dimensions = '3d';
case 'areaChart' :
$this->_renderAreaChart($groupCount,$dimensions);
break;
case 'bar3DChart' :
$dimensions = '3d';
case 'barChart' :
$this->_renderBarChart($groupCount,$dimensions);
break;
case 'line3DChart' :
$dimensions = '3d';
case 'lineChart' :
$this->_renderLineChart($groupCount,$dimensions);
break;
case 'pie3DChart' :
$dimensions = '3d';
case 'pieChart' :
$this->_renderPieChart($groupCount,$dimensions,False,False);
break;
case 'doughnut3DChart' :
$dimensions = '3d';
case 'doughnutChart' :
$this->_renderPieChart($groupCount,$dimensions,True,True);
break;
case 'scatterChart' :
$this->_renderScatterChart($groupCount);
break;
case 'bubbleChart' :
$this->_renderBubbleChart($groupCount);
break;
case 'radarChart' :
$this->_renderRadarChart($groupCount);
break;
case 'surface3DChart' :
$dimensions = '3d';
case 'surfaceChart' :
$this->_renderContourChart($groupCount,$dimensions);
break;
case 'stockChart' :
$this->_renderStockChart($groupCount,$dimensions);
break;
default :
echo $chartType.' is not yet implemented<br />';
return false;
}
$this->_renderLegend();
 
$this->_graph->Stroke($outputDestination);
return true;
} // function render()
 
 
/**
* Create a new PHPExcel_Chart_Renderer_jpgraph
*/
public function __construct(PHPExcel_Chart $chart)
{
$this->_graph = null;
$this->_chart = $chart;
} // function __construct()
 
} // PHPExcel_Chart_Renderer_jpgraph
/branches/v2.25-scarificateur/jrest/lib/PHPExcel/Classes/PHPExcel/Chart/Renderer/PHP Charting Libraries.txt
New file
0,0 → 1,17
ChartDirector
http://www.advsofteng.com/cdphp.html
 
GraPHPite
http://graphpite.sourceforge.net/
 
JpGraph
http://www.aditus.nu/jpgraph/
 
LibChart
http://naku.dohcrew.com/libchart/pages/introduction/
 
pChart
http://pchart.sourceforge.net/
 
TeeChart
http://www.steema.com/products/teechart/overview.html
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/branches/v2.25-scarificateur/jrest/lib/PHPExcel/Classes/PHPExcel/Chart/Title.php
New file
0,0 → 1,89
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2013 PHPExcel
*
* 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
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
 
 
/**
* PHPExcel_Chart_Title
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Title
{
 
/**
* Title Caption
*
* @var string
*/
private $_caption = null;
 
/**
* Title Layout
*
* @var PHPExcel_Chart_Layout
*/
private $_layout = null;
 
/**
* Create a new PHPExcel_Chart_Title
*/
public function __construct($caption = null, PHPExcel_Chart_Layout $layout = null)
{
$this->_caption = $caption;
$this->_layout = $layout;
}
 
/**
* Get caption
*
* @return string
*/
public function getCaption() {
return $this->_caption;
}
 
/**
* Set caption
*
* @param string $caption
*/
public function setCaption($caption = null) {
$this->_caption = $caption;
}
 
/**
* Get Layout
*
* @return PHPExcel_Chart_Layout
*/
public function getLayout() {
return $this->_layout;
}
 
}