More psr-2 for charts

This commit is contained in:
MarkBaker 2015-05-15 09:11:18 +01:00
parent 66169af898
commit e18ba38f16
10 changed files with 545 additions and 536 deletions

View File

@ -14,7 +14,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_axis_number = array( private $axisNumber = array(
'format' => self::FORMAT_CODE_GENERAL, 'format' => self::FORMAT_CODE_GENERAL,
'source_linked' => 1 'source_linked' => 1
); );
@ -24,7 +24,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_axis_options = array( private $axisOptions = array(
'minimum' => null, 'minimum' => null,
'maximum' => null, 'maximum' => null,
'major_unit' => null, 'major_unit' => null,
@ -42,7 +42,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_fill_properties = array( private $fillProperties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB, 'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => null, 'value' => null,
'alpha' => 0 'alpha' => 0
@ -53,7 +53,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_line_properties = array( private $lineProperties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB, 'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => null, 'value' => null,
'alpha' => 0 'alpha' => 0
@ -64,7 +64,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_line_style_properties = array( private $lineStyleProperties = array(
'width' => '9525', 'width' => '9525',
'compound' => self::LINE_STYLE_COMPOUND_SIMPLE, 'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
'dash' => self::LINE_STYLE_DASH_SOLID, 'dash' => self::LINE_STYLE_DASH_SOLID,
@ -87,7 +87,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_shadow_properties = array( private $shadowProperties = array(
'presets' => self::SHADOW_PRESETS_NOSHADOW, 'presets' => self::SHADOW_PRESETS_NOSHADOW,
'effect' => null, 'effect' => null,
'color' => array( 'color' => array(
@ -112,7 +112,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_glow_properties = array( private $glowProperties = array(
'size' => null, 'size' => null,
'color' => array( 'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD, 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
@ -126,7 +126,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @var array of mixed * @var array of mixed
*/ */
private $_soft_edges = array( private $softEdges = array(
'size' => null 'size' => null
); );
@ -137,8 +137,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function setAxisNumberProperties($format_code) public function setAxisNumberProperties($format_code)
{ {
$this->_axis_number['format'] = (string) $format_code; $this->axisNumber['format'] = (string) $format_code;
$this->_axis_number['source_linked'] = 0; $this->axisNumber['source_linked'] = 0;
} }
/** /**
@ -148,7 +148,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getAxisNumberFormat() public function getAxisNumberFormat()
{ {
return $this->_axis_number['format']; return $this->axisNumber['format'];
} }
/** /**
@ -158,7 +158,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getAxisNumberSourceLinked() public function getAxisNumberSourceLinked()
{ {
return (string) $this->_axis_number['source_linked']; return (string) $this->axisNumber['source_linked'];
} }
/** /**
@ -178,17 +178,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null) public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null)
{ {
$this->_axis_options['axis_labels'] = (string) $axis_labels; $this->axisOptions['axis_labels'] = (string) $axis_labels;
($horizontal_crosses_value !== null) ? $this->_axis_options['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null; ($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
($horizontal_crosses !== null) ? $this->_axis_options['horizontal_crosses'] = (string) $horizontal_crosses : null; ($horizontal_crosses !== null) ? $this->axisOptions['horizontal_crosses'] = (string) $horizontal_crosses : null;
($axis_orientation !== null) ? $this->_axis_options['orientation'] = (string) $axis_orientation : null; ($axis_orientation !== null) ? $this->axisOptions['orientation'] = (string) $axis_orientation : null;
($major_tmt !== null) ? $this->_axis_options['major_tick_mark'] = (string) $major_tmt : null; ($major_tmt !== null) ? $this->axisOptions['major_tick_mark'] = (string) $major_tmt : null;
($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null; ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null; ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
($minimum !== null) ? $this->_axis_options['minimum'] = (string) $minimum : null; ($minimum !== null) ? $this->axisOptions['minimum'] = (string) $minimum : null;
($maximum !== null) ? $this->_axis_options['maximum'] = (string) $maximum : null; ($maximum !== null) ? $this->axisOptions['maximum'] = (string) $maximum : null;
($major_unit !== null) ? $this->_axis_options['major_unit'] = (string) $major_unit : null; ($major_unit !== null) ? $this->axisOptions['major_unit'] = (string) $major_unit : null;
($minor_unit !== null) ? $this->_axis_options['minor_unit'] = (string) $minor_unit : null; ($minor_unit !== null) ? $this->axisOptions['minor_unit'] = (string) $minor_unit : null;
} }
/** /**
@ -200,7 +200,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getAxisOptionsProperty($property) public function getAxisOptionsProperty($property)
{ {
return $this->_axis_options[$property]; return $this->axisOptions[$property];
} }
/** /**
@ -224,7 +224,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{ {
$this->_fill_properties = $this->setColorProperties($color, $alpha, $type); $this->fillProperties = $this->setColorProperties($color, $alpha, $type);
} }
/** /**
@ -237,7 +237,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{ {
$this->_line_properties = $this->setColorProperties($color, $alpha, $type); $this->lineProperties = $this->setColorProperties($color, $alpha, $type);
} }
/** /**
@ -249,7 +249,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getFillProperty($property) public function getFillProperty($property)
{ {
return $this->_fill_properties[$property]; return $this->fillProperties[$property];
} }
/** /**
@ -261,7 +261,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getLineProperty($property) public function getLineProperty($property)
{ {
return $this->_line_properties[$property]; return $this->lineProperties[$property];
} }
/** /**
@ -278,16 +278,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $end_arrow_size * @param string $end_arrow_size
* *
*/ */
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) { public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
(!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width) : null; {
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null; (!is_null($line_width)) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
(!is_null($dash_type)) ? $this->_line_style_properties['dash'] = (string) $dash_type : null; (!is_null($compound_type)) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null;
(!is_null($cap_type)) ? $this->_line_style_properties['cap'] = (string) $cap_type : null; (!is_null($dash_type)) ? $this->lineStyleProperties['dash'] = (string) $dash_type : null;
(!is_null($join_type)) ? $this->_line_style_properties['join'] = (string) $join_type : null; (!is_null($cap_type)) ? $this->lineStyleProperties['cap'] = (string) $cap_type : null;
(!is_null($head_arrow_type)) ? $this->_line_style_properties['arrow']['head']['type'] = (string) $head_arrow_type : null; (!is_null($join_type)) ? $this->lineStyleProperties['join'] = (string) $join_type : null;
(!is_null($head_arrow_size)) ? $this->_line_style_properties['arrow']['head']['size'] = (string) $head_arrow_size : null; (!is_null($head_arrow_type)) ? $this->lineStyleProperties['arrow']['head']['type'] = (string) $head_arrow_type : null;
(!is_null($end_arrow_type)) ? $this->_line_style_properties['arrow']['end']['type'] = (string) $end_arrow_type : null; (!is_null($head_arrow_size)) ? $this->lineStyleProperties['arrow']['head']['size'] = (string) $head_arrow_size : null;
(!is_null($end_arrow_size)) ? $this->_line_style_properties['arrow']['end']['size'] = (string) $end_arrow_size : null; (!is_null($end_arrow_type)) ? $this->lineStyleProperties['arrow']['end']['type'] = (string) $end_arrow_type : null;
(!is_null($end_arrow_size)) ? $this->lineStyleProperties['arrow']['end']['size'] = (string) $end_arrow_size : null;
} }
/** /**
@ -299,7 +300,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getLineStyleProperty($elements) public function getLineStyleProperty($elements)
{ {
return $this->getArrayElementsValue($this->_line_style_properties, $elements); return $this->getArrayElementsValue($this->lineStyleProperties, $elements);
} }
/** /**
@ -311,7 +312,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getLineStyleArrowWidth($arrow) public function getLineStyleArrowWidth($arrow)
{ {
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w'); return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w');
} }
/** /**
@ -323,7 +324,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/ */
public function getLineStyleArrowLength($arrow) public function getLineStyleArrowLength($arrow)
{ {
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len'); return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len');
} }
/** /**
@ -338,15 +339,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param float $sh_distance * @param float $sh_distance
* *
*/ */
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) { public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
$this->_setShadowPresetsProperties((int) $sh_presets) {
->_setShadowColor( $this->setShadowPresetsProperties((int) $sh_presets)
is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value ->setShadowColor(
, is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha'] : $sh_color_alpha is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
, is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type) is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $sh_color_alpha,
->_setShadowBlur($sh_blur) is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
->_setShadowAngle($sh_angle) )
->_setShadowDistance($sh_distance); ->setShadowBlur($sh_blur)
->setShadowAngle($sh_angle)
->setShadowDistance($sh_distance);
} }
/** /**
@ -356,9 +359,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowPresetsProperties($shadow_presets) { private function setShadowPresetsProperties($shadow_presets)
$this->_shadow_properties['presets'] = $shadow_presets; {
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets)); $this->shadowProperties['presets'] = $shadow_presets;
$this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
return $this; return $this;
} }
@ -371,19 +375,20 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowProperiesMapValues(array $properties_map, &$reference = null) { private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{
$base_reference = $reference; $base_reference = $reference;
foreach ($properties_map as $property_key => $property_val) { foreach ($properties_map as $property_key => $property_val) {
if (is_array($property_val)) { if (is_array($property_val)) {
if ($reference === null) { if ($reference === null) {
$reference = & $this->_shadow_properties[$property_key]; $reference = & $this->shadowProperties[$property_key];
} else { } else {
$reference = & $reference[$property_key]; $reference = & $reference[$property_key];
} }
$this->_setShadowProperiesMapValues($property_val, $reference); $this->setShadowProperiesMapValues($property_val, $reference);
} else { } else {
if ($base_reference === null) { if ($base_reference === null) {
$this->_shadow_properties[$property_key] = $property_val; $this->shadowProperties[$property_key] = $property_val;
} else { } else {
$reference[$property_key] = $property_val; $reference[$property_key] = $property_val;
} }
@ -402,8 +407,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowColor($color, $alpha, $type) { private function setShadowColor($color, $alpha, $type)
$this->_shadow_properties['color'] = $this->setColorProperties($color, $alpha, $type); {
$this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
return $this; return $this;
} }
@ -415,9 +421,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowBlur($blur) { private function setShadowBlur($blur)
{
if ($blur !== null) { if ($blur !== null) {
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur); $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
} }
return $this; return $this;
@ -430,9 +437,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowAngle($angle) { private function setShadowAngle($angle)
{
if ($angle !== null) { if ($angle !== null) {
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle); $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
} }
return $this; return $this;
@ -445,9 +453,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setShadowDistance($distance) { private function setShadowDistance($distance)
{
if ($distance !== null) { if ($distance !== null) {
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance); $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
} }
return $this; return $this;
@ -461,8 +470,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param int $color_alpha * @param int $color_alpha
* @param string $color_type * @param string $color_type
*/ */
public function getShadowProperty($elements) { public function getShadowProperty($elements)
return $this->getArrayElementsValue($this->_shadow_properties, $elements); {
return $this->getArrayElementsValue($this->shadowProperties, $elements);
} }
/** /**
@ -473,12 +483,13 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param int $color_alpha * @param int $color_alpha
* @param string $color_type * @param string $color_type
*/ */
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) { public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
$this->_setGlowSize($size) {
->_setGlowColor( $this->setGlowSize($size)
is_null($color_value) ? $this->_glow_properties['color']['value'] : $color_value ->setGlowColor(
, is_null($color_alpha) ? (int) $this->_glow_properties['color']['alpha'] : $color_alpha is_null($color_value) ? $this->glowProperties['color']['value'] : $color_value,
, is_null($color_type) ? $this->_glow_properties['color']['type'] : $color_type is_null($color_alpha) ? (int) $this->glowProperties['color']['alpha'] : $color_alpha,
is_null($color_type) ? $this->glowProperties['color']['type'] : $color_type
); );
} }
@ -489,8 +500,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return string * @return string
*/ */
public function getGlowProperty($property) { public function getGlowProperty($property)
return $this->getArrayElementsValue($this->_glow_properties, $property); {
return $this->getArrayElementsValue($this->glowProperties, $property);
} }
/** /**
@ -500,9 +512,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setGlowSize($size) { private function setGlowSize($size)
{
if (!is_null($size)) { if (!is_null($size)) {
$this->_glow_properties['size'] = $this->getExcelPointsWidth($size); $this->glowProperties['size'] = $this->getExcelPointsWidth($size);
} }
return $this; return $this;
@ -517,8 +530,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_Axis * @return PHPExcel_Chart_Axis
*/ */
private function _setGlowColor($color, $alpha, $type) { private function setGlowColor($color, $alpha, $type)
$this->_glow_properties['color'] = $this->setColorProperties($color, $alpha, $type); {
$this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
return $this; return $this;
} }
@ -528,9 +542,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @param float $size * @param float $size
*/ */
public function setSoftEdges($size) { public function setSoftEdges($size)
{
if (!is_null($size)) { if (!is_null($size)) {
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size); $softEdges['size'] = (string) $this->getExcelPointsWidth($size);
} }
} }
@ -539,7 +554,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* *
* @return string * @return string
*/ */
public function getSoftEdgesSize() { public function getSoftEdgesSize()
return $this->_soft_edges['size']; {
return $this->softEdges['size'];
} }
} }

View File

@ -75,90 +75,90 @@ class PHPExcel_Chart_DataSeries
* *
* @var string * @var string
*/ */
private $_plotType = null; private $plotType;
/** /**
* Plot Grouping Type * Plot Grouping Type
* *
* @var boolean * @var boolean
*/ */
private $_plotGrouping = null; private $plotGrouping;
/** /**
* Plot Direction * Plot Direction
* *
* @var boolean * @var boolean
*/ */
private $_plotDirection = null; private $plotDirection;
/** /**
* Plot Style * Plot Style
* *
* @var string * @var string
*/ */
private $_plotStyle = null; private $plotStyle;
/** /**
* Order of plots in Series * Order of plots in Series
* *
* @var array of integer * @var array of integer
*/ */
private $_plotOrder = array(); private $plotOrder = array();
/** /**
* Plot Label * Plot Label
* *
* @var array of PHPExcel_Chart_DataSeriesValues * @var array of PHPExcel_Chart_DataSeriesValues
*/ */
private $_plotLabel = array(); private $plotLabel = array();
/** /**
* Plot Category * Plot Category
* *
* @var array of PHPExcel_Chart_DataSeriesValues * @var array of PHPExcel_Chart_DataSeriesValues
*/ */
private $_plotCategory = array(); private $plotCategory = array();
/** /**
* Smooth Line * Smooth Line
* *
* @var string * @var string
*/ */
private $_smoothLine = null; private $smoothLine;
/** /**
* Plot Values * Plot Values
* *
* @var array of PHPExcel_Chart_DataSeriesValues * @var array of PHPExcel_Chart_DataSeriesValues
*/ */
private $_plotValues = array(); private $plotValues = array();
/** /**
* Create a new PHPExcel_Chart_DataSeries * Create a new PHPExcel_Chart_DataSeries
*/ */
public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null) public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null)
{ {
$this->_plotType = $plotType; $this->plotType = $plotType;
$this->_plotGrouping = $plotGrouping; $this->plotGrouping = $plotGrouping;
$this->_plotOrder = $plotOrder; $this->plotOrder = $plotOrder;
$keys = array_keys($plotValues); $keys = array_keys($plotValues);
$this->_plotValues = $plotValues; $this->plotValues = $plotValues;
if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) { if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
$plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
} }
$this->_plotLabel = $plotLabel; $this->plotLabel = $plotLabel;
if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) { if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
$plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
} }
$this->_plotCategory = $plotCategory; $this->plotCategory = $plotCategory;
$this->_smoothLine = $smoothLine; $this->smoothLine = $smoothLine;
$this->_plotStyle = $plotStyle; $this->plotStyle = $plotStyle;
if (is_null($plotDirection)) { if (is_null($plotDirection)) {
$plotDirection = self::DIRECTION_COL; $plotDirection = self::DIRECTION_COL;
} }
$this->_plotDirection = $plotDirection; $this->plotDirection = $plotDirection;
} }
/** /**
@ -168,7 +168,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotType() public function getPlotType()
{ {
return $this->_plotType; return $this->plotType;
} }
/** /**
@ -179,7 +179,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setPlotType($plotType = '') public function setPlotType($plotType = '')
{ {
$this->_plotType = $plotType; $this->plotType = $plotType;
return $this; return $this;
} }
@ -190,7 +190,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotGrouping() public function getPlotGrouping()
{ {
return $this->_plotGrouping; return $this->plotGrouping;
} }
/** /**
@ -201,7 +201,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setPlotGrouping($groupingType = null) public function setPlotGrouping($groupingType = null)
{ {
$this->_plotGrouping = $groupingType; $this->plotGrouping = $groupingType;
return $this; return $this;
} }
@ -212,7 +212,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotDirection() public function getPlotDirection()
{ {
return $this->_plotDirection; return $this->plotDirection;
} }
/** /**
@ -223,7 +223,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setPlotDirection($plotDirection = null) public function setPlotDirection($plotDirection = null)
{ {
$this->_plotDirection = $plotDirection; $this->plotDirection = $plotDirection;
return $this; return $this;
} }
@ -234,7 +234,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotOrder() public function getPlotOrder()
{ {
return $this->_plotOrder; return $this->plotOrder;
} }
/** /**
@ -244,7 +244,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotLabels() public function getPlotLabels()
{ {
return $this->_plotLabel; return $this->plotLabel;
} }
/** /**
@ -254,11 +254,11 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotLabelByIndex($index) public function getPlotLabelByIndex($index)
{ {
$keys = array_keys($this->_plotLabel); $keys = array_keys($this->plotLabel);
if (in_array($index, $keys)) { if (in_array($index, $keys)) {
return $this->_plotLabel[$index]; return $this->plotLabel[$index];
} elseif (isset($keys[$index])) { } elseif (isset($keys[$index])) {
return $this->_plotLabel[$keys[$index]]; return $this->plotLabel[$keys[$index]];
} }
return false; return false;
} }
@ -270,7 +270,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotCategories() public function getPlotCategories()
{ {
return $this->_plotCategory; return $this->plotCategory;
} }
/** /**
@ -280,11 +280,11 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotCategoryByIndex($index) public function getPlotCategoryByIndex($index)
{ {
$keys = array_keys($this->_plotCategory); $keys = array_keys($this->plotCategory);
if (in_array($index, $keys)) { if (in_array($index, $keys)) {
return $this->_plotCategory[$index]; return $this->plotCategory[$index];
} elseif (isset($keys[$index])) { } elseif (isset($keys[$index])) {
return $this->_plotCategory[$keys[$index]]; return $this->plotCategory[$keys[$index]];
} }
return false; return false;
} }
@ -296,7 +296,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotStyle() public function getPlotStyle()
{ {
return $this->_plotStyle; return $this->plotStyle;
} }
/** /**
@ -307,7 +307,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setPlotStyle($plotStyle = null) public function setPlotStyle($plotStyle = null)
{ {
$this->_plotStyle = $plotStyle; $this->plotStyle = $plotStyle;
return $this; return $this;
} }
@ -318,7 +318,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotValues() public function getPlotValues()
{ {
return $this->_plotValues; return $this->plotValues;
} }
/** /**
@ -328,11 +328,11 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotValuesByIndex($index) public function getPlotValuesByIndex($index)
{ {
$keys = array_keys($this->_plotValues); $keys = array_keys($this->plotValues);
if (in_array($index, $keys)) { if (in_array($index, $keys)) {
return $this->_plotValues[$index]; return $this->plotValues[$index];
} elseif (isset($keys[$index])) { } elseif (isset($keys[$index])) {
return $this->_plotValues[$keys[$index]]; return $this->plotValues[$keys[$index]];
} }
return false; return false;
} }
@ -344,7 +344,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getPlotSeriesCount() public function getPlotSeriesCount()
{ {
return count($this->_plotValues); return count($this->plotValues);
} }
/** /**
@ -354,7 +354,7 @@ class PHPExcel_Chart_DataSeries
*/ */
public function getSmoothLine() public function getSmoothLine()
{ {
return $this->_smoothLine; return $this->smoothLine;
} }
/** /**
@ -365,23 +365,23 @@ class PHPExcel_Chart_DataSeries
*/ */
public function setSmoothLine($smoothLine = true) public function setSmoothLine($smoothLine = true)
{ {
$this->_smoothLine = $smoothLine; $this->smoothLine = $smoothLine;
return $this; return $this;
} }
public function refresh(PHPExcel_Worksheet $worksheet) public function refresh(PHPExcel_Worksheet $worksheet)
{ {
foreach ($this->_plotValues as $plotValues) { foreach ($this->plotValues as $plotValues) {
if ($plotValues !== null) { if ($plotValues !== null) {
$plotValues->refresh($worksheet, true); $plotValues->refresh($worksheet, true);
} }
} }
foreach ($this->_plotLabel as $plotValues) { foreach ($this->plotLabel as $plotValues) {
if ($plotValues !== null) { if ($plotValues !== null) {
$plotValues->refresh($worksheet, true); $plotValues->refresh($worksheet, true);
} }
} }
foreach ($this->_plotCategory as $plotValues) { foreach ($this->plotCategory as $plotValues) {
if ($plotValues !== null) { if ($plotValues !== null) {
$plotValues->refresh($worksheet, false); $plotValues->refresh($worksheet, false);
} }

View File

@ -31,7 +31,7 @@ class PHPExcel_Chart_DataSeriesValues
const DATASERIES_TYPE_STRING = 'String'; const DATASERIES_TYPE_STRING = 'String';
const DATASERIES_TYPE_NUMBER = 'Number'; const DATASERIES_TYPE_NUMBER = 'Number';
private static $_dataTypeValues = array( private static $dataTypeValues = array(
self::DATASERIES_TYPE_STRING, self::DATASERIES_TYPE_STRING,
self::DATASERIES_TYPE_NUMBER, self::DATASERIES_TYPE_NUMBER,
); );
@ -41,42 +41,42 @@ class PHPExcel_Chart_DataSeriesValues
* *
* @var string * @var string
*/ */
private $_dataType = null; private $dataType;
/** /**
* Series Data Source * Series Data Source
* *
* @var string * @var string
*/ */
private $_dataSource = null; private $dataSource;
/** /**
* Format Code * Format Code
* *
* @var string * @var string
*/ */
private $_formatCode = null; private $formatCode;
/** /**
* Series Point Marker * Series Point Marker
* *
* @var string * @var string
*/ */
private $_marker = null; private $pointMarker;
/** /**
* Point Count (The number of datapoints in the dataseries) * Point Count (The number of datapoints in the dataseries)
* *
* @var integer * @var integer
*/ */
private $_pointCount = 0; private $pointCount = 0;
/** /**
* Data Values * Data Values
* *
* @var array of mixed * @var array of mixed
*/ */
private $_dataValues = array(); private $dataValues = array();
/** /**
* Create a new PHPExcel_Chart_DataSeriesValues object * Create a new PHPExcel_Chart_DataSeriesValues object
@ -84,11 +84,11 @@ class PHPExcel_Chart_DataSeriesValues
public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null)
{ {
$this->setDataType($dataType); $this->setDataType($dataType);
$this->_dataSource = $dataSource; $this->dataSource = $dataSource;
$this->_formatCode = $formatCode; $this->formatCode = $formatCode;
$this->_pointCount = $pointCount; $this->pointCount = $pointCount;
$this->_dataValues = $dataValues; $this->dataValues = $dataValues;
$this->_marker = $marker; $this->pointMarker = $marker;
} }
/** /**
@ -98,7 +98,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getDataType() public function getDataType()
{ {
return $this->_dataType; return $this->dataType;
} }
/** /**
@ -114,10 +114,10 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER) public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER)
{ {
if (!in_array($dataType, self::$_dataTypeValues)) { if (!in_array($dataType, self::$dataTypeValues)) {
throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values'); throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values');
} }
$this->_dataType = $dataType; $this->dataType = $dataType;
return $this; return $this;
} }
@ -129,7 +129,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getDataSource() public function getDataSource()
{ {
return $this->_dataSource; return $this->dataSource;
} }
/** /**
@ -140,7 +140,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function setDataSource($dataSource = null, $refreshDataValues = true) public function setDataSource($dataSource = null, $refreshDataValues = true)
{ {
$this->_dataSource = $dataSource; $this->dataSource = $dataSource;
if ($refreshDataValues) { if ($refreshDataValues) {
// TO DO // TO DO
@ -156,7 +156,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getPointMarker() public function getPointMarker()
{ {
return $this->_marker; return $this->pointMarker;
} }
/** /**
@ -167,7 +167,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function setPointMarker($marker = null) public function setPointMarker($marker = null)
{ {
$this->_marker = $marker; $this->pointMarker = $marker;
return $this; return $this;
} }
@ -179,7 +179,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getFormatCode() public function getFormatCode()
{ {
return $this->_formatCode; return $this->formatCode;
} }
/** /**
@ -190,7 +190,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function setFormatCode($formatCode = null) public function setFormatCode($formatCode = null)
{ {
$this->_formatCode = $formatCode; $this->formatCode = $formatCode;
return $this; return $this;
} }
@ -202,7 +202,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getPointCount() public function getPointCount()
{ {
return $this->_pointCount; return $this->pointCount;
} }
/** /**
@ -212,8 +212,8 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function isMultiLevelSeries() public function isMultiLevelSeries()
{ {
if (count($this->_dataValues) > 0) { if (count($this->dataValues) > 0) {
return is_array($this->_dataValues[0]); return is_array($this->dataValues[0]);
} }
return null; return null;
} }
@ -226,8 +226,8 @@ class PHPExcel_Chart_DataSeriesValues
public function multiLevelCount() public function multiLevelCount()
{ {
$levelCount = 0; $levelCount = 0;
foreach ($this->_dataValues as $dataValueSet) { foreach ($this->dataValues as $dataValueSet) {
$levelCount = max($levelCount,count($dataValueSet)); $levelCount = max($levelCount, count($dataValueSet));
} }
return $levelCount; return $levelCount;
} }
@ -239,7 +239,7 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getDataValues() public function getDataValues()
{ {
return $this->_dataValues; return $this->dataValues;
} }
/** /**
@ -249,13 +249,13 @@ class PHPExcel_Chart_DataSeriesValues
*/ */
public function getDataValue() public function getDataValue()
{ {
$count = count($this->_dataValues); $count = count($this->dataValues);
if ($count == 0) { if ($count == 0) {
return null; return null;
} elseif ($count == 1) { } elseif ($count == 1) {
return $this->_dataValues[0]; return $this->dataValues[0];
} }
return $this->_dataValues; return $this->dataValues;
} }
/** /**
@ -263,14 +263,14 @@ class PHPExcel_Chart_DataSeriesValues
* *
* @param array $dataValues * @param array $dataValues
* @param boolean $refreshDataSource * @param boolean $refreshDataSource
* TRUE - refresh the value of _dataSource based on the values of $dataValues * TRUE - refresh the value of dataSource based on the values of $dataValues
* FALSE - don't change the value of _dataSource * FALSE - don't change the value of dataSource
* @return PHPExcel_Chart_DataSeriesValues * @return PHPExcel_Chart_DataSeriesValues
*/ */
public function setDataValues($dataValues = array(), $refreshDataSource = true) public function setDataValues($dataValues = array(), $refreshDataSource = true)
{ {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues); $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
$this->_pointCount = count($dataValues); $this->pointCount = count($dataValues);
if ($refreshDataSource) { if ($refreshDataSource) {
// TO DO // TO DO
@ -279,39 +279,39 @@ class PHPExcel_Chart_DataSeriesValues
return $this; return $this;
} }
private function _stripNulls($var) private function stripNulls($var)
{ {
return $var !== null; return $var !== null;
} }
public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true) public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true)
{ {
if ($this->_dataSource !== null) { if ($this->dataSource !== null) {
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
$newDataValues = PHPExcel_Calculation::_unwrapResult( $newDataValues = PHPExcel_Calculation::_unwrapResult(
$calcEngine->_calculateFormulaValue( $calcEngine->_calculateFormulaValue(
'='.$this->_dataSource, '='.$this->dataSource,
null, null,
$worksheet->getCell('A1') $worksheet->getCell('A1')
) )
); );
if ($flatten) { if ($flatten) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
foreach ($this->_dataValues as &$dataValue) { foreach ($this->dataValues as &$dataValue) {
if ((!empty($dataValue)) && ($dataValue[0] == '#')) { if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
$dataValue = 0.0; $dataValue = 0.0;
} }
} }
unset($dataValue); unset($dataValue);
} else { } else {
$cellRange = explode('!', $this->_dataSource); $cellRange = explode('!', $this->dataSource);
if (count($cellRange) > 1) { if (count($cellRange) > 1) {
list(, $cellRange) = $cellRange; list(, $cellRange) = $cellRange;
} }
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange)); $dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange));
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) { if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
} else { } else {
$newArray = array_values(array_shift($newDataValues)); $newArray = array_values(array_shift($newDataValues));
foreach ($newArray as $i => $newDataSet) { foreach ($newArray as $i => $newDataSet) {
@ -324,10 +324,10 @@ class PHPExcel_Chart_DataSeriesValues
array_unshift($newArray[$i++], $newDataVal); array_unshift($newArray[$i++], $newDataVal);
} }
} }
$this->_dataValues = $newArray; $this->dataValues = $newArray;
} }
} }
$this->_pointCount = count($this->_dataValues); $this->pointCount = count($this->dataValues);
} }
} }
} }

View File

@ -20,9 +20,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* *
*/ */
private $_object_state = false; private $objectState = false;
private $_line_properties = array( private $lineProperties = array(
'color' => array( 'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD, 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
'value' => null, 'value' => null,
@ -47,7 +47,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
) )
); );
private $_shadow_properties = array( private $shadowProperties = array(
'presets' => self::SHADOW_PRESETS_NOSHADOW, 'presets' => self::SHADOW_PRESETS_NOSHADOW,
'effect' => null, 'effect' => null,
'color' => array( 'color' => array(
@ -67,7 +67,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
'rotWithShape' => null 'rotWithShape' => null
); );
private $_glow_properties = array( private $glowProperties = array(
'size' => null, 'size' => null,
'color' => array( 'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD, 'type' => self::EXCEL_COLOR_TYPE_STANDARD,
@ -76,7 +76,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
) )
); );
private $_soft_edges = array( private $softEdges = array(
'size' => null 'size' => null
); );
@ -88,7 +88,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getObjectState() public function getObjectState()
{ {
return $this->_object_state; return $this->objectState;
} }
/** /**
@ -97,9 +97,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _activateObject() private function activateObject()
{ {
$this->_object_state = true; $this->objectState = true;
return $this; return $this;
} }
@ -114,12 +114,12 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD) public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD)
{ {
$this $this->activateObject()
->_activateObject() ->lineProperties['color'] = $this->setColorProperties(
->_line_properties['color'] = $this->setColorProperties(
$value, $value,
$alpha, $alpha,
$type); $type
);
} }
/** /**
@ -138,33 +138,33 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
{ {
$this->_activateObject(); $this->activateObject();
(!is_null($line_width)) (!is_null($line_width))
? $this->_line_properties['style']['width'] = $this->getExcelPointsWidth((float) $line_width) ? $this->lineProperties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
: null; : null;
(!is_null($compound_type)) (!is_null($compound_type))
? $this->_line_properties['style']['compound'] = (string) $compound_type ? $this->lineProperties['style']['compound'] = (string) $compound_type
: null; : null;
(!is_null($dash_type)) (!is_null($dash_type))
? $this->_line_properties['style']['dash'] = (string) $dash_type ? $this->lineProperties['style']['dash'] = (string) $dash_type
: null; : null;
(!is_null($cap_type)) (!is_null($cap_type))
? $this->_line_properties['style']['cap'] = (string) $cap_type ? $this->lineProperties['style']['cap'] = (string) $cap_type
: null; : null;
(!is_null($join_type)) (!is_null($join_type))
? $this->_line_properties['style']['join'] = (string) $join_type ? $this->lineProperties['style']['join'] = (string) $join_type
: null; : null;
(!is_null($head_arrow_type)) (!is_null($head_arrow_type))
? $this->_line_properties['style']['arrow']['head']['type'] = (string) $head_arrow_type ? $this->lineProperties['style']['arrow']['head']['type'] = (string) $head_arrow_type
: null; : null;
(!is_null($head_arrow_size)) (!is_null($head_arrow_size))
? $this->_line_properties['style']['arrow']['head']['size'] = (string) $head_arrow_size ? $this->lineProperties['style']['arrow']['head']['size'] = (string) $head_arrow_size
: null; : null;
(!is_null($end_arrow_type)) (!is_null($end_arrow_type))
? $this->_line_properties['style']['arrow']['end']['type'] = (string) $end_arrow_type ? $this->lineProperties['style']['arrow']['end']['type'] = (string) $end_arrow_type
: null; : null;
(!is_null($end_arrow_size)) (!is_null($end_arrow_size))
? $this->_line_properties['style']['arrow']['end']['size'] = (string) $end_arrow_size ? $this->lineProperties['style']['arrow']['end']['size'] = (string) $end_arrow_size
: null; : null;
} }
@ -178,7 +178,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineColorProperty($parameter) public function getLineColorProperty($parameter)
{ {
return $this->_line_properties['color'][$parameter]; return $this->lineProperties['color'][$parameter];
} }
/** /**
@ -191,7 +191,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineStyleProperty($elements) public function getLineStyleProperty($elements)
{ {
return $this->getArrayElementsValue($this->_line_properties['style'], $elements); return $this->getArrayElementsValue($this->lineProperties['style'], $elements);
} }
/** /**
@ -207,9 +207,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
{ {
$this $this
->_activateObject() ->activateObject()
->_setGlowSize($size) ->setGlowSize($size)
->_setGlowColor($color_value, $color_alpha, $color_type); ->setGlowColor($color_value, $color_alpha, $color_type);
} }
/** /**
@ -222,7 +222,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getGlowColor($property) public function getGlowColor($property)
{ {
return $this->_glow_properties['color'][$property]; return $this->glowProperties['color'][$property];
} }
/** /**
@ -233,7 +233,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getGlowSize() public function getGlowSize()
{ {
return $this->_glow_properties['size']; return $this->glowProperties['size'];
} }
/** /**
@ -244,9 +244,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setGlowSize($size) private function setGlowSize($size)
{ {
$this->_glow_properties['size'] = $this->getExcelPointsWidth((float) $size); $this->glowProperties['size'] = $this->getExcelPointsWidth((float) $size);
return $this; return $this;
} }
@ -261,16 +261,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setGlowColor($color, $alpha, $type) private function setGlowColor($color, $alpha, $type)
{ {
if (!is_null($color)) { if (!is_null($color)) {
$this->_glow_properties['color']['value'] = (string) $color; $this->glowProperties['color']['value'] = (string) $color;
} }
if (!is_null($alpha)) { if (!is_null($alpha)) {
$this->_glow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha); $this->glowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
} }
if (!is_null($type)) { if (!is_null($type)) {
$this->_glow_properties['color']['type'] = (string) $type; $this->glowProperties['color']['type'] = (string) $type;
} }
return $this; return $this;
@ -287,7 +287,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineStyleArrowParameters($arrow_selector, $property_selector) public function getLineStyleArrowParameters($arrow_selector, $property_selector)
{ {
return $this->getLineStyleArrowSize($this->_line_properties['style']['arrow'][$arrow_selector]['size'], $property_selector); return $this->getLineStyleArrowSize($this->lineProperties['style']['arrow'][$arrow_selector]['size'], $property_selector);
} }
/** /**
@ -305,17 +305,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
{ {
$this $this->activateObject()
->_activateObject() ->setShadowPresetsProperties((int) $sh_presets)
->_setShadowPresetsProperties((int) $sh_presets) ->setShadowColor(
->_setShadowColor( is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $this->getTrueAlpha($sh_color_alpha),
, is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha'] is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
: $this->getTrueAlpha($sh_color_alpha) )
, is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type) ->setShadowBlur($sh_blur)
->_setShadowBlur($sh_blur) ->setShadowAngle($sh_angle)
->_setShadowAngle($sh_angle) ->setShadowDistance($sh_distance);
->_setShadowDistance($sh_distance);
} }
/** /**
@ -326,10 +325,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowPresetsProperties($shadow_presets) private function setShadowPresetsProperties($shadow_presets)
{ {
$this->_shadow_properties['presets'] = $shadow_presets; $this->shadowProperties['presets'] = $shadow_presets;
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets)); $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
return $this; return $this;
} }
@ -343,20 +342,20 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowProperiesMapValues(array $properties_map, &$reference = null) private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{ {
$base_reference = $reference; $base_reference = $reference;
foreach ($properties_map as $property_key => $property_val) { foreach ($properties_map as $property_key => $property_val) {
if (is_array($property_val)) { if (is_array($property_val)) {
if ($reference === null) { if ($reference === null) {
$reference = & $this->_shadow_properties[$property_key]; $reference = & $this->shadowProperties[$property_key];
} else { } else {
$reference = & $reference[$property_key]; $reference = & $reference[$property_key];
} }
$this->_setShadowProperiesMapValues($property_val, $reference); $this->setShadowProperiesMapValues($property_val, $reference);
} else { } else {
if ($base_reference === null) { if ($base_reference === null) {
$this->_shadow_properties[$property_key] = $property_val; $this->shadowProperties[$property_key] = $property_val;
} else { } else {
$reference[$property_key] = $property_val; $reference[$property_key] = $property_val;
} }
@ -374,16 +373,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @param string $type * @param string $type
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowColor($color, $alpha, $type) private function setShadowColor($color, $alpha, $type)
{ {
if (!is_null($color)) { if (!is_null($color)) {
$this->_shadow_properties['color']['value'] = (string) $color; $this->shadowProperties['color']['value'] = (string) $color;
} }
if (!is_null($alpha)) { if (!is_null($alpha)) {
$this->_shadow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha); $this->shadowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
} }
if (!is_null($type)) { if (!is_null($type)) {
$this->_shadow_properties['color']['type'] = (string) $type; $this->shadowProperties['color']['type'] = (string) $type;
} }
return $this; return $this;
@ -396,10 +395,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* *
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowBlur($blur) private function setShadowBlur($blur)
{ {
if ($blur !== null) { if ($blur !== null) {
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur); $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
} }
return $this; return $this;
@ -412,10 +411,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowAngle($angle) private function setShadowAngle($angle)
{ {
if ($angle !== null) { if ($angle !== null) {
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle); $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
} }
return $this; return $this;
@ -427,10 +426,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @param float $distance * @param float $distance
* @return PHPExcel_Chart_GridLines * @return PHPExcel_Chart_GridLines
*/ */
private function _setShadowDistance($distance) private function setShadowDistance($distance)
{ {
if ($distance !== null) { if ($distance !== null) {
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance); $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
} }
return $this; return $this;
@ -445,7 +444,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*/ */
public function getShadowProperty($elements) public function getShadowProperty($elements)
{ {
return $this->getArrayElementsValue($this->_shadow_properties, $elements); return $this->getArrayElementsValue($this->shadowProperties, $elements);
} }
/** /**
@ -456,8 +455,8 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setSoftEdgesSize($size) public function setSoftEdgesSize($size)
{ {
if (!is_null($size)) { if (!is_null($size)) {
$this->_activateObject(); $this->activateObject();
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size); $softEdges['size'] = (string) $this->getExcelPointsWidth($size);
} }
} }
@ -468,6 +467,6 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*/ */
public function getSoftEdgesSize() public function getSoftEdgesSize()
{ {
return $this->_soft_edges['size']; return $this->softEdges['size'];
} }
} }

View File

@ -40,49 +40,49 @@ class PHPExcel_Chart_Layout
* *
* @var string * @var string
*/ */
private $_layoutTarget = null; private $layoutTarget;
/** /**
* X Mode * X Mode
* *
* @var string * @var string
*/ */
private $_xMode = null; private $xMode;
/** /**
* Y Mode * Y Mode
* *
* @var string * @var string
*/ */
private $_yMode = null; private $yMode;
/** /**
* X-Position * X-Position
* *
* @var float * @var float
*/ */
private $_xPos = null; private $xPos;
/** /**
* Y-Position * Y-Position
* *
* @var float * @var float
*/ */
private $_yPos = null; private $yPos;
/** /**
* width * width
* *
* @var float * @var float
*/ */
private $_width = null; private $width;
/** /**
* height * height
* *
* @var float * @var float
*/ */
private $_height = null; private $height;
/** /**
* show legend key * show legend key
@ -90,7 +90,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showLegendKey = null; private $showLegendKey;
/** /**
* show value * show value
@ -98,7 +98,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showVal = null; private $showVal;
/** /**
* show category name * show category name
@ -106,7 +106,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showCatName = null; private $showCatName;
/** /**
* show data series name * show data series name
@ -114,7 +114,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showSerName = null; private $showSerName;
/** /**
* show percentage * show percentage
@ -122,14 +122,14 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showPercent = null; private $showPercent;
/** /**
* show bubble size * show bubble size
* *
* @var boolean * @var boolean
*/ */
private $_showBubbleSize = null; private $showBubbleSize;
/** /**
* show leader lines * show leader lines
@ -137,7 +137,7 @@ class PHPExcel_Chart_Layout
* *
* @var boolean * @var boolean
*/ */
private $_showLeaderLines = null; private $showLeaderLines;
/** /**
@ -146,25 +146,25 @@ class PHPExcel_Chart_Layout
public function __construct($layout = array()) public function __construct($layout = array())
{ {
if (isset($layout['layoutTarget'])) { if (isset($layout['layoutTarget'])) {
$this->_layoutTarget = $layout['layoutTarget']; $this->layoutTarget = $layout['layoutTarget'];
} }
if (isset($layout['xMode'])) { if (isset($layout['xMode'])) {
$this->_xMode = $layout['xMode']; $this->xMode = $layout['xMode'];
} }
if (isset($layout['yMode'])) { if (isset($layout['yMode'])) {
$this->_yMode = $layout['yMode']; $this->yMode = $layout['yMode'];
} }
if (isset($layout['x'])) { if (isset($layout['x'])) {
$this->_xPos = (float) $layout['x']; $this->xPos = (float) $layout['x'];
} }
if (isset($layout['y'])) { if (isset($layout['y'])) {
$this->_yPos = (float) $layout['y']; $this->yPos = (float) $layout['y'];
} }
if (isset($layout['w'])) { if (isset($layout['w'])) {
$this->_width = (float) $layout['w']; $this->width = (float) $layout['w'];
} }
if (isset($layout['h'])) { if (isset($layout['h'])) {
$this->_height = (float) $layout['h']; $this->height = (float) $layout['h'];
} }
} }
@ -175,7 +175,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getLayoutTarget() public function getLayoutTarget()
{ {
return $this->_layoutTarget; return $this->layoutTarget;
} }
/** /**
@ -186,7 +186,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setLayoutTarget($value) public function setLayoutTarget($value)
{ {
$this->_layoutTarget = $value; $this->layoutTarget = $value;
return $this; return $this;
} }
@ -197,7 +197,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getXMode() public function getXMode()
{ {
return $this->_xMode; return $this->xMode;
} }
/** /**
@ -208,7 +208,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setXMode($value) public function setXMode($value)
{ {
$this->_xMode = $value; $this->xMode = $value;
return $this; return $this;
} }
@ -219,7 +219,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getYMode() public function getYMode()
{ {
return $this->_yMode; return $this->yMode;
} }
/** /**
@ -230,7 +230,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setYMode($value) public function setYMode($value)
{ {
$this->_yMode = $value; $this->yMode = $value;
return $this; return $this;
} }
@ -241,7 +241,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getXPosition() public function getXPosition()
{ {
return $this->_xPos; return $this->xPos;
} }
/** /**
@ -252,7 +252,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setXPosition($value) public function setXPosition($value)
{ {
$this->_xPos = $value; $this->xPos = $value;
return $this; return $this;
} }
@ -263,7 +263,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getYPosition() public function getYPosition()
{ {
return $this->_yPos; return $this->yPos;
} }
/** /**
@ -274,7 +274,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setYPosition($value) public function setYPosition($value)
{ {
$this->_yPos = $value; $this->yPos = $value;
return $this; return $this;
} }
@ -285,7 +285,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getWidth() public function getWidth()
{ {
return $this->_width; return $this->width;
} }
/** /**
@ -296,7 +296,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setWidth($value) public function setWidth($value)
{ {
$this->_width = $value; $this->width = $value;
return $this; return $this;
} }
@ -307,7 +307,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getHeight() public function getHeight()
{ {
return $this->_height; return $this->height;
} }
/** /**
@ -318,7 +318,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setHeight($value) public function setHeight($value)
{ {
$this->_height = $value; $this->height = $value;
return $this; return $this;
} }
@ -330,7 +330,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowLegendKey() public function getShowLegendKey()
{ {
return $this->_showLegendKey; return $this->showLegendKey;
} }
/** /**
@ -342,7 +342,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowLegendKey($value) public function setShowLegendKey($value)
{ {
$this->_showLegendKey = $value; $this->showLegendKey = $value;
return $this; return $this;
} }
@ -353,7 +353,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowVal() public function getShowVal()
{ {
return $this->_showVal; return $this->showVal;
} }
/** /**
@ -365,7 +365,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowVal($value) public function setShowVal($value)
{ {
$this->_showVal = $value; $this->showVal = $value;
return $this; return $this;
} }
@ -376,7 +376,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowCatName() public function getShowCatName()
{ {
return $this->_showCatName; return $this->showCatName;
} }
/** /**
@ -388,7 +388,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowCatName($value) public function setShowCatName($value)
{ {
$this->_showCatName = $value; $this->showCatName = $value;
return $this; return $this;
} }
@ -399,7 +399,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowSerName() public function getShowSerName()
{ {
return $this->_showSerName; return $this->showSerName;
} }
/** /**
@ -411,7 +411,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowSerName($value) public function setShowSerName($value)
{ {
$this->_showSerName = $value; $this->showSerName = $value;
return $this; return $this;
} }
@ -422,7 +422,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowPercent() public function getShowPercent()
{ {
return $this->_showPercent; return $this->showPercent;
} }
/** /**
@ -434,7 +434,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowPercent($value) public function setShowPercent($value)
{ {
$this->_showPercent = $value; $this->showPercent = $value;
return $this; return $this;
} }
@ -445,7 +445,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowBubbleSize() public function getShowBubbleSize()
{ {
return $this->_showBubbleSize; return $this->showBubbleSize;
} }
/** /**
@ -457,7 +457,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowBubbleSize($value) public function setShowBubbleSize($value)
{ {
$this->_showBubbleSize = $value; $this->showBubbleSize = $value;
return $this; return $this;
} }
@ -468,7 +468,7 @@ class PHPExcel_Chart_Layout
*/ */
public function getShowLeaderLines() public function getShowLeaderLines()
{ {
return $this->_showLeaderLines; return $this->showLeaderLines;
} }
/** /**
@ -480,7 +480,7 @@ class PHPExcel_Chart_Layout
*/ */
public function setShowLeaderLines($value) public function setShowLeaderLines($value)
{ {
$this->_showLeaderLines = $value; $this->showLeaderLines = $value;
return $this; return $this;
} }
} }

View File

@ -28,26 +28,26 @@
class PHPExcel_Chart_Legend class PHPExcel_Chart_Legend
{ {
/** Legend positions */ /** Legend positions */
const xlLegendPositionBottom = -4107; // Below the chart. const xlLegendPositionBottom = -4107; // Below the chart.
const xlLegendPositionCorner = 2; // In the upper right-hand corner of the chart border. const xlLegendPositionCorner = 2; // In the upper right-hand corner of the chart border.
const xlLegendPositionCustom = -4161; // A custom position. const xlLegendPositionCustom = -4161; // A custom position.
const xlLegendPositionLeft = -4131; // Left of the chart. const xlLegendPositionLeft = -4131; // Left of the chart.
const xlLegendPositionRight = -4152; // Right of the chart. const xlLegendPositionRight = -4152; // Right of the chart.
const xlLegendPositionTop = -4160; // Above the chart. const xlLegendPositionTop = -4160; // Above the chart.
const POSITION_RIGHT = 'r'; const POSITION_RIGHT = 'r';
const POSITION_LEFT = 'l'; const POSITION_LEFT = 'l';
const POSITION_BOTTOM = 'b'; const POSITION_BOTTOM = 'b';
const POSITION_TOP = 't'; const POSITION_TOP = 't';
const POSITION_TOPRIGHT = 'tr'; const POSITION_TOPRIGHT = 'tr';
private static $_positionXLref = array( private static $_positionXLref = array(
self::xlLegendPositionBottom => self::POSITION_BOTTOM, self::xlLegendPositionBottom => self::POSITION_BOTTOM,
self::xlLegendPositionCorner => self::POSITION_TOPRIGHT, self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
self::xlLegendPositionCustom => '??', self::xlLegendPositionCustom => '??',
self::xlLegendPositionLeft => self::POSITION_LEFT, self::xlLegendPositionLeft => self::POSITION_LEFT,
self::xlLegendPositionRight => self::POSITION_RIGHT, self::xlLegendPositionRight => self::POSITION_RIGHT,
self::xlLegendPositionTop => self::POSITION_TOP self::xlLegendPositionTop => self::POSITION_TOP
); );
/** /**
@ -55,30 +55,30 @@ class PHPExcel_Chart_Legend
* *
* @var string * @var string
*/ */
private $_position = self::POSITION_RIGHT; private $position = self::POSITION_RIGHT;
/** /**
* Allow overlay of other elements? * Allow overlay of other elements?
* *
* @var boolean * @var boolean
*/ */
private $_overlay = TRUE; private $overlay = true;
/** /**
* Legend Layout * Legend Layout
* *
* @var PHPExcel_Chart_Layout * @var PHPExcel_Chart_Layout
*/ */
private $_layout = NULL; private $layout = null;
/** /**
* Create a new PHPExcel_Chart_Legend * Create a new PHPExcel_Chart_Legend
*/ */
public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = NULL, $overlay = FALSE) public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = null, $overlay = false)
{ {
$this->setPosition($position); $this->setPosition($position);
$this->_layout = $layout; $this->layout = $layout;
$this->setOverlay($overlay); $this->setOverlay($overlay);
} }
@ -87,8 +87,9 @@ class PHPExcel_Chart_Legend
* *
* @return string * @return string
*/ */
public function getPosition() { public function getPosition()
return $this->_position; {
return $this->position;
} }
/** /**
@ -96,12 +97,13 @@ class PHPExcel_Chart_Legend
* *
* @param string $position * @param string $position
*/ */
public function setPosition($position = self::POSITION_RIGHT) { public function setPosition($position = self::POSITION_RIGHT)
if (!in_array($position,self::$_positionXLref)) { {
if (!in_array($position, self::$_positionXLref)) {
return false; return false;
} }
$this->_position = $position; $this->position = $position;
return true; return true;
} }
@ -110,8 +112,9 @@ class PHPExcel_Chart_Legend
* *
* @return number * @return number
*/ */
public function getPositionXL() { public function getPositionXL()
return array_search($this->_position,self::$_positionXLref); {
return array_search($this->position, self::$_positionXLref);
} }
/** /**
@ -119,12 +122,13 @@ class PHPExcel_Chart_Legend
* *
* @param number $positionXL * @param number $positionXL
*/ */
public function setPositionXL($positionXL = self::xlLegendPositionRight) { public function setPositionXL($positionXL = self::xlLegendPositionRight)
if (!array_key_exists($positionXL,self::$_positionXLref)) { {
if (!array_key_exists($positionXL, self::$_positionXLref)) {
return false; return false;
} }
$this->_position = self::$_positionXLref[$positionXL]; $this->position = self::$_positionXLref[$positionXL];
return true; return true;
} }
@ -133,8 +137,9 @@ class PHPExcel_Chart_Legend
* *
* @return boolean * @return boolean
*/ */
public function getOverlay() { public function getOverlay()
return $this->_overlay; {
return $this->overlay;
} }
/** /**
@ -143,12 +148,13 @@ class PHPExcel_Chart_Legend
* @param boolean $overlay * @param boolean $overlay
* @return boolean * @return boolean
*/ */
public function setOverlay($overlay = FALSE) { public function setOverlay($overlay = false)
{
if (!is_bool($overlay)) { if (!is_bool($overlay)) {
return false; return false;
} }
$this->_overlay = $overlay; $this->overlay = $overlay;
return true; return true;
} }
@ -157,8 +163,8 @@ class PHPExcel_Chart_Legend
* *
* @return PHPExcel_Chart_Layout * @return PHPExcel_Chart_Layout
*/ */
public function getLayout() { public function getLayout()
return $this->_layout; {
return $this->layout;
} }
} }

View File

@ -32,22 +32,22 @@ class PHPExcel_Chart_PlotArea
* *
* @var PHPExcel_Chart_Layout * @var PHPExcel_Chart_Layout
*/ */
private $_layout = null; private $layout = null;
/** /**
* Plot Series * Plot Series
* *
* @var array of PHPExcel_Chart_DataSeries * @var array of PHPExcel_Chart_DataSeries
*/ */
private $_plotSeries = array(); private $plotSeries = array();
/** /**
* Create a new PHPExcel_Chart_PlotArea * Create a new PHPExcel_Chart_PlotArea
*/ */
public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array()) public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
{ {
$this->_layout = $layout; $this->layout = $layout;
$this->_plotSeries = $plotSeries; $this->plotSeries = $plotSeries;
} }
/** /**
@ -57,7 +57,7 @@ class PHPExcel_Chart_PlotArea
*/ */
public function getLayout() public function getLayout()
{ {
return $this->_layout; return $this->layout;
} }
/** /**
@ -67,7 +67,7 @@ class PHPExcel_Chart_PlotArea
*/ */
public function getPlotGroupCount() public function getPlotGroupCount()
{ {
return count($this->_plotSeries); return count($this->plotSeries);
} }
/** /**
@ -78,7 +78,7 @@ class PHPExcel_Chart_PlotArea
public function getPlotSeriesCount() public function getPlotSeriesCount()
{ {
$seriesCount = 0; $seriesCount = 0;
foreach ($this->_plotSeries as $plot) { foreach ($this->plotSeries as $plot) {
$seriesCount += $plot->getPlotSeriesCount(); $seriesCount += $plot->getPlotSeriesCount();
} }
return $seriesCount; return $seriesCount;
@ -91,7 +91,7 @@ class PHPExcel_Chart_PlotArea
*/ */
public function getPlotGroup() public function getPlotGroup()
{ {
return $this->_plotSeries; return $this->plotSeries;
} }
/** /**
@ -101,7 +101,7 @@ class PHPExcel_Chart_PlotArea
*/ */
public function getPlotGroupByIndex($index) public function getPlotGroupByIndex($index)
{ {
return $this->_plotSeries[$index]; return $this->plotSeries[$index];
} }
/** /**
@ -112,14 +112,14 @@ class PHPExcel_Chart_PlotArea
*/ */
public function setPlotSeries($plotSeries = array()) public function setPlotSeries($plotSeries = array())
{ {
$this->_plotSeries = $plotSeries; $this->plotSeries = $plotSeries;
return $this; return $this;
} }
public function refresh(PHPExcel_Worksheet $worksheet) public function refresh(PHPExcel_Worksheet $worksheet)
{ {
foreach ($this->_plotSeries as $plotSeries) { foreach ($this->plotSeries as $plotSeries) {
$plotSeries->refresh($worksheet); $plotSeries->refresh($worksheet);
} }
} }

View File

@ -70,7 +70,7 @@ abstract class PHPExcel_Chart_Properties
LINE_STYLE_JOIN_MITER = 'miter', LINE_STYLE_JOIN_MITER = 'miter',
LINE_STYLE_JOIN_BEVEL = 'bevel', LINE_STYLE_JOIN_BEVEL = 'bevel',
LINE_STYLE_ARROW_TYPE_NOARROW = NULL, LINE_STYLE_ARROW_TYPE_NOARROW = null,
LINE_STYLE_ARROW_TYPE_ARROW = 'triangle', LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
LINE_STYLE_ARROW_TYPE_OPEN = 'arrow', LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth', LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
@ -88,7 +88,7 @@ abstract class PHPExcel_Chart_Properties
LINE_STYLE_ARROW_SIZE_9 = 9; LINE_STYLE_ARROW_SIZE_9 = 9;
const const
SHADOW_PRESETS_NOSHADOW = NULL, SHADOW_PRESETS_NOSHADOW = null,
SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1, SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
SHADOW_PRESETS_OUTER_BOTTOM = 2, SHADOW_PRESETS_OUTER_BOTTOM = 2,
SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3, SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
@ -113,19 +113,19 @@ abstract class PHPExcel_Chart_Properties
SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22, SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23; SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
protected function getExcelPointsWidth($width) protected function getExcelPointsWidth($width)
{ {
return $width * 12700; return $width * 12700;
} }
protected function getExcelPointsAngle($angle) protected function getExcelPointsAngle($angle)
{ {
return $angle * 60000; return $angle * 60000;
} }
protected function getTrueAlpha($alpha) protected function getTrueAlpha($alpha)
{ {
return (string) 100 - $alpha . '000'; return (string) 100 - $alpha . '000';
} }
protected function setColorProperties($color, $alpha, $type) protected function setColorProperties($color, $alpha, $type)
@ -137,7 +137,8 @@ abstract class PHPExcel_Chart_Properties
); );
} }
protected function getLineStyleArrowSize($array_selector, $array_kay_selector) { protected function getLineStyleArrowSize($array_selector, $array_kay_selector)
{
$sizes = array( $sizes = array(
1 => array('w' => 'sm', 'len' => 'sm'), 1 => array('w' => 'sm', 'len' => 'sm'),
2 => array('w' => 'sm', 'len' => 'med'), 2 => array('w' => 'sm', 'len' => 'med'),
@ -153,7 +154,8 @@ abstract class PHPExcel_Chart_Properties
return $sizes[$array_selector][$array_kay_selector]; return $sizes[$array_selector][$array_kay_selector];
} }
protected function getShadowPresetsMap($shadow_presets_option) { protected function getShadowPresetsMap($shadow_presets_option)
{
$presets_options = array( $presets_options = array(
//OUTER //OUTER
1 => array( 1 => array(
@ -345,7 +347,8 @@ abstract class PHPExcel_Chart_Properties
return $presets_options[$shadow_presets_option]; return $presets_options[$shadow_presets_option];
} }
protected function getArrayElementsValue($properties, $elements) { protected function getArrayElementsValue($properties, $elements)
{
$reference = & $properties; $reference = & $properties;
if (!is_array($elements)) { if (!is_array($elements)) {
return $reference[$elements]; return $reference[$elements];
@ -357,4 +360,4 @@ abstract class PHPExcel_Chart_Properties
} }
return $this; return $this;
} }
} }

View File

@ -1,7 +1,9 @@
<?php <?php
require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
/** /**
* PHPExcel * PHPExcel_Chart_Renderer_jpgraph
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -25,81 +27,71 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
/**
* PHPExcel_Chart_Renderer_jpgraph
*
* @category PHPExcel
* @package PHPExcel_Chart_Renderer
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Renderer_jpgraph class PHPExcel_Chart_Renderer_jpgraph
{ {
private static $_width = 640; private static $width = 640;
private static $_height = 480; private static $height = 480;
private static $_colourSet = array( 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1', private static $colourSet = array(
'darkmagenta', 'coral', 'dodgerblue3', 'eggplant', 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1',
'mediumblue', 'magenta', 'sandybrown', 'cyan', 'darkmagenta', 'coral', 'dodgerblue3', 'eggplant',
'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen', 'mediumblue', 'magenta', 'sandybrown', 'cyan',
'goldenrod2' 'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen',
); 'goldenrod2'
);
private static $_markSet = array( 'diamond' => MARK_DIAMOND, private static $markSet = array(
'square' => MARK_SQUARE, 'diamond' => MARK_DIAMOND,
'triangle' => MARK_UTRIANGLE, 'square' => MARK_SQUARE,
'x' => MARK_X, 'triangle' => MARK_UTRIANGLE,
'star' => MARK_STAR, 'x' => MARK_X,
'dot' => MARK_FILLEDCIRCLE, 'star' => MARK_STAR,
'dash' => MARK_DTRIANGLE, 'dot' => MARK_FILLEDCIRCLE,
'circle' => MARK_CIRCLE, 'dash' => MARK_DTRIANGLE,
'plus' => MARK_CROSS 'circle' => MARK_CIRCLE,
); 'plus' => MARK_CROSS
);
private $_chart = null; private $chart;
private $_graph = null; private $graph;
private static $_plotColour = 0; private static $_plotColour = 0;
private static $_plotMark = 0; private static $_plotMark = 0;
private function _formatPointMarker($seriesPlot, $markerID) { private function formatPointMarker($seriesPlot, $markerID) {
$plotMarkKeys = array_keys(self::$_markSet); $plotMarkKeys = array_keys(self::$markSet);
if (is_null($markerID)) { if (is_null($markerID)) {
// Use default plot marker (next marker in the series) // Use default plot marker (next marker in the series)
self::$_plotMark %= count(self::$_markSet); self::$_plotMark %= count(self::$markSet);
$seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]); $seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$_plotMark++]]);
} elseif ($markerID !== 'none') { } elseif ($markerID !== 'none') {
// Use specified plot marker (if it exists) // Use specified plot marker (if it exists)
if (isset(self::$_markSet[$markerID])) { if (isset(self::$markSet[$markerID])) {
$seriesPlot->mark->SetType(self::$_markSet[$markerID]); $seriesPlot->mark->SetType(self::$markSet[$markerID]);
} else { } else {
// If the specified plot marker doesn't exist, use default plot marker (next marker in the series) // If the specified plot marker doesn't exist, use default plot marker (next marker in the series)
self::$_plotMark %= count(self::$_markSet); self::$_plotMark %= count(self::$markSet);
$seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]); $seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$_plotMark++]]);
} }
} else { } else {
// Hide plot marker // Hide plot marker
$seriesPlot->mark->Hide(); $seriesPlot->mark->Hide();
} }
$seriesPlot->mark->SetColor(self::$_colourSet[self::$_plotColour]); $seriesPlot->mark->SetColor(self::$colourSet[self::$_plotColour]);
$seriesPlot->mark->SetFillColor(self::$_colourSet[self::$_plotColour]); $seriesPlot->mark->SetFillColor(self::$colourSet[self::$_plotColour]);
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]); $seriesPlot->SetColor(self::$colourSet[self::$_plotColour++]);
return $seriesPlot; return $seriesPlot;
} // function _formatPointMarker() }
private function _formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '') { private function formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '') {
$datasetLabelFormatCode = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode(); $datasetLabelFormatCode = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode();
if (!is_null($datasetLabelFormatCode)) { if (!is_null($datasetLabelFormatCode)) {
// Retrieve any label formatting code // Retrieve any label formatting code
$datasetLabelFormatCode = stripslashes($datasetLabelFormatCode); $datasetLabelFormatCode = stripslashes($datasetLabelFormatCode);
@ -124,16 +116,16 @@ class PHPExcel_Chart_Renderer_jpgraph
} }
return $datasetLabels; return $datasetLabels;
} // function _formatDataSetLabels() }
private function _percentageSumCalculation($groupID, $seriesCount) { private function _percentageSumCalculation($groupID, $seriesCount) {
// Adjust our values to a percentage value across all series in the group // Adjust our values to a percentage value across all series in the group
for($i = 0; $i < $seriesCount; ++$i) { for($i = 0; $i < $seriesCount; ++$i) {
if ($i == 0) { if ($i == 0) {
$sumValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); $sumValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
} else { } else {
$nextValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); $nextValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
foreach ($nextValues as $k => $value) { foreach ($nextValues as $k => $value) {
if (isset($sumValues[$k])) { if (isset($sumValues[$k])) {
$sumValues[$k] += $value; $sumValues[$k] += $value;
@ -173,75 +165,75 @@ class PHPExcel_Chart_Renderer_jpgraph
private function _renderTitle() { private function _renderTitle() {
$title = $this->_getCaption($this->_chart->getTitle()); $title = $this->_getCaption($this->chart->getTitle());
if (!is_null($title)) { if (!is_null($title)) {
$this->_graph->title->Set($title); $this->graph->title->Set($title);
} }
} // function _renderTitle() } // function _renderTitle()
private function _renderLegend() { private function _renderLegend() {
$legend = $this->_chart->getLegend(); $legend = $this->chart->getLegend();
if (!is_null($legend)) { if (!is_null($legend)) {
$legendPosition = $legend->getPosition(); $legendPosition = $legend->getPosition();
$legendOverlay = $legend->getOverlay(); $legendOverlay = $legend->getOverlay();
switch ($legendPosition) { switch ($legendPosition) {
case 'r' : case 'r' :
$this->_graph->legend->SetPos(0.01,0.5,'right','center'); // right $this->graph->legend->SetPos(0.01,0.5,'right','center'); // right
$this->_graph->legend->SetColumns(1); $this->graph->legend->SetColumns(1);
break; break;
case 'l' : case 'l' :
$this->_graph->legend->SetPos(0.01,0.5,'left','center'); // left $this->graph->legend->SetPos(0.01,0.5,'left','center'); // left
$this->_graph->legend->SetColumns(1); $this->graph->legend->SetColumns(1);
break; break;
case 't' : case 't' :
$this->_graph->legend->SetPos(0.5,0.01,'center','top'); // top $this->graph->legend->SetPos(0.5,0.01,'center','top'); // top
break; break;
case 'b' : case 'b' :
$this->_graph->legend->SetPos(0.5,0.99,'center','bottom'); // bottom $this->graph->legend->SetPos(0.5,0.99,'center','bottom'); // bottom
break; break;
default : default :
$this->_graph->legend->SetPos(0.01,0.01,'right','top'); // top-right $this->graph->legend->SetPos(0.01,0.01,'right','top'); // top-right
$this->_graph->legend->SetColumns(1); $this->graph->legend->SetColumns(1);
break; break;
} }
} else { } else {
$this->_graph->legend->Hide(); $this->graph->legend->Hide();
} }
} // function _renderLegend() } // function _renderLegend()
private function _renderCartesianPlotArea($type='textlin') { private function _renderCartesianPlotArea($type='textlin') {
$this->_graph = new Graph(self::$_width,self::$_height); $this->graph = new Graph(self::$width,self::$height);
$this->_graph->SetScale($type); $this->graph->SetScale($type);
$this->_renderTitle(); $this->_renderTitle();
// Rotate for bar rather than column chart // Rotate for bar rather than column chart
$rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection(); $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection();
$reverse = ($rotation == 'bar') ? true : false; $reverse = ($rotation == 'bar') ? true : false;
$xAxisLabel = $this->_chart->getXAxisLabel(); $xAxisLabel = $this->chart->getXAxisLabel();
if (!is_null($xAxisLabel)) { if (!is_null($xAxisLabel)) {
$title = $this->_getCaption($xAxisLabel); $title = $this->_getCaption($xAxisLabel);
if (!is_null($title)) { if (!is_null($title)) {
$this->_graph->xaxis->SetTitle($title,'center'); $this->graph->xaxis->SetTitle($title,'center');
$this->_graph->xaxis->title->SetMargin(35); $this->graph->xaxis->title->SetMargin(35);
if ($reverse) { if ($reverse) {
$this->_graph->xaxis->title->SetAngle(90); $this->graph->xaxis->title->SetAngle(90);
$this->_graph->xaxis->title->SetMargin(90); $this->graph->xaxis->title->SetMargin(90);
} }
} }
} }
$yAxisLabel = $this->_chart->getYAxisLabel(); $yAxisLabel = $this->chart->getYAxisLabel();
if (!is_null($yAxisLabel)) { if (!is_null($yAxisLabel)) {
$title = $this->_getCaption($yAxisLabel); $title = $this->_getCaption($yAxisLabel);
if (!is_null($title)) { if (!is_null($title)) {
$this->_graph->yaxis->SetTitle($title,'center'); $this->graph->yaxis->SetTitle($title,'center');
if ($reverse) { if ($reverse) {
$this->_graph->yaxis->title->SetAngle(0); $this->graph->yaxis->title->SetAngle(0);
$this->_graph->yaxis->title->SetMargin(-55); $this->graph->yaxis->title->SetMargin(-55);
} }
} }
} }
@ -249,31 +241,31 @@ class PHPExcel_Chart_Renderer_jpgraph
private function _renderPiePlotArea($doughnut = False) { private function _renderPiePlotArea($doughnut = False) {
$this->_graph = new PieGraph(self::$_width,self::$_height); $this->graph = new PieGraph(self::$width,self::$height);
$this->_renderTitle(); $this->_renderTitle();
} // function _renderPiePlotArea() } // function _renderPiePlotArea()
private function _renderRadarPlotArea() { private function _renderRadarPlotArea() {
$this->_graph = new RadarGraph(self::$_width,self::$_height); $this->graph = new RadarGraph(self::$width,self::$height);
$this->_graph->SetScale('lin'); $this->graph->SetScale('lin');
$this->_renderTitle(); $this->_renderTitle();
} // function _renderRadarPlotArea() } // function _renderRadarPlotArea()
private function _renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') { private function _renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount()); $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) { if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount); $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
$this->_graph->xaxis->SetTickLabels($datasetLabels); $this->graph->xaxis->SetTickLabels($datasetLabels);
} }
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array(); $seriesPlots = array();
if ($grouping == 'percentStacked') { if ($grouping == 'percentStacked') {
$sumValues = $this->_percentageSumCalculation($groupID, $seriesCount); $sumValues = $this->_percentageSumCalculation($groupID, $seriesCount);
@ -281,8 +273,8 @@ class PHPExcel_Chart_Renderer_jpgraph
// Loop through each data series in turn // Loop through each data series in turn
for($i = 0; $i < $seriesCount; ++$i) { for($i = 0; $i < $seriesCount; ++$i) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
if ($grouping == 'percentStacked') { if ($grouping == 'percentStacked') {
$dataValues = $this->_percentageAdjustValues($dataValues, $sumValues); $dataValues = $this->_percentageAdjustValues($dataValues, $sumValues);
@ -306,12 +298,12 @@ class PHPExcel_Chart_Renderer_jpgraph
if ($filled) { if ($filled) {
$seriesPlot->SetFilled(true); $seriesPlot->SetFilled(true);
$seriesPlot->SetColor('black'); $seriesPlot->SetColor('black');
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]); $seriesPlot->SetFillColor(self::$colourSet[self::$_plotColour++]);
} else { } else {
// Set the appropriate plot marker // Set the appropriate plot marker
$this->_formatPointMarker($seriesPlot, $marker); $this->formatPointMarker($seriesPlot, $marker);
} }
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetLegend($dataLabel); $seriesPlot->SetLegend($dataLabel);
$seriesPlots[] = $seriesPlot; $seriesPlots[] = $seriesPlot;
@ -322,34 +314,34 @@ class PHPExcel_Chart_Renderer_jpgraph
} else { } else {
$groupPlot = new AccLinePlot($seriesPlots); $groupPlot = new AccLinePlot($seriesPlots);
} }
$this->_graph->Add($groupPlot); $this->graph->Add($groupPlot);
} // function _renderPlotLine() } // function _renderPlotLine()
private function _renderPlotBar($groupID, $dimensions = '2d') { private function _renderPlotBar($groupID, $dimensions = '2d') {
$rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection(); $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
// Rotate for bar rather than column chart // Rotate for bar rather than column chart
if (($groupID == 0) && ($rotation == 'bar')) { if (($groupID == 0) && ($rotation == 'bar')) {
$this->_graph->Set90AndMargin(); $this->graph->Set90AndMargin();
} }
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount()); $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) { if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation); $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation);
// Rotate for bar rather than column chart // Rotate for bar rather than column chart
if ($rotation == 'bar') { if ($rotation == 'bar') {
$datasetLabels = array_reverse($datasetLabels); $datasetLabels = array_reverse($datasetLabels);
$this->_graph->yaxis->SetPos('max'); $this->graph->yaxis->SetPos('max');
$this->_graph->yaxis->SetLabelAlign('center','top'); $this->graph->yaxis->SetLabelAlign('center','top');
$this->_graph->yaxis->SetLabelSide(SIDE_RIGHT); $this->graph->yaxis->SetLabelSide(SIDE_RIGHT);
} }
$this->_graph->xaxis->SetTickLabels($datasetLabels); $this->graph->xaxis->SetTickLabels($datasetLabels);
} }
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array(); $seriesPlots = array();
if ($grouping == 'percentStacked') { if ($grouping == 'percentStacked') {
$sumValues = $this->_percentageSumCalculation($groupID, $seriesCount); $sumValues = $this->_percentageSumCalculation($groupID, $seriesCount);
@ -357,7 +349,7 @@ class PHPExcel_Chart_Renderer_jpgraph
// Loop through each data series in turn // Loop through each data series in turn
for($j = 0; $j < $seriesCount; ++$j) { for($j = 0; $j < $seriesCount; ++$j) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues(); $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
if ($grouping == 'percentStacked') { if ($grouping == 'percentStacked') {
$dataValues = $this->_percentageAdjustValues($dataValues, $sumValues); $dataValues = $this->_percentageAdjustValues($dataValues, $sumValues);
} }
@ -378,14 +370,14 @@ class PHPExcel_Chart_Renderer_jpgraph
} }
$seriesPlot = new BarPlot($dataValues); $seriesPlot = new BarPlot($dataValues);
$seriesPlot->SetColor('black'); $seriesPlot->SetColor('black');
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]); $seriesPlot->SetFillColor(self::$colourSet[self::$_plotColour++]);
if ($dimensions == '3d') { if ($dimensions == '3d') {
$seriesPlot->SetShadow(); $seriesPlot->SetShadow();
} }
if (!$this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) { if (!$this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) {
$dataLabel = ''; $dataLabel = '';
} else { } else {
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue(); $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue();
} }
$seriesPlot->SetLegend($dataLabel); $seriesPlot->SetLegend($dataLabel);
@ -407,21 +399,21 @@ class PHPExcel_Chart_Renderer_jpgraph
} }
} }
$this->_graph->Add($groupPlot); $this->graph->Add($groupPlot);
} // function _renderPlotBar() } // function _renderPlotBar()
private function _renderPlotScatter($groupID, $bubble) { private function _renderPlotScatter($groupID, $bubble) {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); $scatterStyle = $bubbleSize = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array(); $seriesPlots = array();
// Loop through each data series in turn // Loop through each data series in turn
for($i = 0; $i < $seriesCount; ++$i) { for($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
foreach ($dataValuesY as $k => $dataValueY) { foreach ($dataValuesY as $k => $dataValueY) {
$dataValuesY[$k] = $k; $dataValuesY[$k] = $k;
@ -430,43 +422,43 @@ class PHPExcel_Chart_Renderer_jpgraph
$seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY); $seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY);
if ($scatterStyle == 'lineMarker') { if ($scatterStyle == 'lineMarker') {
$seriesPlot->SetLinkPoints(); $seriesPlot->SetLinkPoints();
$seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]); $seriesPlot->link->SetColor(self::$colourSet[self::$_plotColour]);
} elseif ($scatterStyle == 'smoothMarker') { } elseif ($scatterStyle == 'smoothMarker') {
$spline = new Spline($dataValuesY, $dataValuesX); $spline = new Spline($dataValuesY, $dataValuesX);
list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20); list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$width / 20);
$lplot = new LinePlot($splineDataX, $splineDataY); $lplot = new LinePlot($splineDataX, $splineDataY);
$lplot->SetColor(self::$_colourSet[self::$_plotColour]); $lplot->SetColor(self::$colourSet[self::$_plotColour]);
$this->_graph->Add($lplot); $this->graph->Add($lplot);
} }
if ($bubble) { if ($bubble) {
$this->_formatPointMarker($seriesPlot,'dot'); $this->formatPointMarker($seriesPlot,'dot');
$seriesPlot->mark->SetColor('black'); $seriesPlot->mark->SetColor('black');
$seriesPlot->mark->SetSize($bubbleSize); $seriesPlot->mark->SetSize($bubbleSize);
} else { } else {
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
$this->_formatPointMarker($seriesPlot, $marker); $this->formatPointMarker($seriesPlot, $marker);
} }
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetLegend($dataLabel); $seriesPlot->SetLegend($dataLabel);
$this->_graph->Add($seriesPlot); $this->graph->Add($seriesPlot);
} }
} // function _renderPlotScatter() } // function _renderPlotScatter()
private function _renderPlotRadar($groupID) { private function _renderPlotRadar($groupID) {
$radarStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); $radarStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array(); $seriesPlots = array();
// Loop through each data series in turn // Loop through each data series in turn
for($i = 0; $i < $seriesCount; ++$i) { for($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
$dataValues = array(); $dataValues = array();
foreach ($dataValuesY as $k => $dataValueY) { foreach ($dataValuesY as $k => $dataValueY) {
@ -477,51 +469,51 @@ class PHPExcel_Chart_Renderer_jpgraph
$tmp = array_shift($dataValuesX); $tmp = array_shift($dataValuesX);
$dataValuesX[] = $tmp; $dataValuesX[] = $tmp;
$this->_graph->SetTitles(array_reverse($dataValues)); $this->graph->SetTitles(array_reverse($dataValues));
$seriesPlot = new RadarPlot(array_reverse($dataValuesX)); $seriesPlot = new RadarPlot(array_reverse($dataValuesX));
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]); $seriesPlot->SetColor(self::$colourSet[self::$_plotColour++]);
if ($radarStyle == 'filled') { if ($radarStyle == 'filled') {
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour]); $seriesPlot->SetFillColor(self::$colourSet[self::$_plotColour]);
} }
$this->_formatPointMarker($seriesPlot, $marker); $this->formatPointMarker($seriesPlot, $marker);
$seriesPlot->SetLegend($dataLabel); $seriesPlot->SetLegend($dataLabel);
$this->_graph->Add($seriesPlot); $this->graph->Add($seriesPlot);
} }
} // function _renderPlotRadar() } // function _renderPlotRadar()
private function _renderPlotContour($groupID) { private function _renderPlotContour($groupID) {
$contourStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); $contourStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array(); $seriesPlots = array();
$dataValues = array(); $dataValues = array();
// Loop through each data series in turn // Loop through each data series in turn
for($i = 0; $i < $seriesCount; ++$i) { for($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$dataValues[$i] = $dataValuesX; $dataValues[$i] = $dataValuesX;
} }
$seriesPlot = new ContourPlot($dataValues); $seriesPlot = new ContourPlot($dataValues);
$this->_graph->Add($seriesPlot); $this->graph->Add($seriesPlot);
} // function _renderPlotContour() } // function _renderPlotContour()
private function _renderPlotStock($groupID) { private function _renderPlotStock($groupID) {
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder(); $plotOrder = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
$dataValues = array(); $dataValues = array();
// Loop through each data series in turn and build the plot arrays // Loop through each data series in turn and build the plot arrays
foreach ($plotOrder as $i => $v) { foreach ($plotOrder as $i => $v) {
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues(); $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
foreach ($dataValuesX as $j => $dataValueX) { foreach ($dataValuesX as $j => $dataValueX) {
$dataValues[$plotOrder[$i]][$j] = $dataValueX; $dataValues[$plotOrder[$i]][$j] = $dataValueX;
} }
@ -539,17 +531,17 @@ class PHPExcel_Chart_Renderer_jpgraph
} }
// Set the x-axis labels // Set the x-axis labels
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount()); $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) { if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount); $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
$this->_graph->xaxis->SetTickLabels($datasetLabels); $this->graph->xaxis->SetTickLabels($datasetLabels);
} }
$seriesPlot = new StockPlot($dataValuesPlot); $seriesPlot = new StockPlot($dataValuesPlot);
$seriesPlot->SetWidth(20); $seriesPlot->SetWidth(20);
$this->_graph->Add($seriesPlot); $this->graph->Add($seriesPlot);
} // function _renderPlotStock() } // function _renderPlotStock()
@ -620,23 +612,23 @@ class PHPExcel_Chart_Renderer_jpgraph
$iLimit = ($multiplePlots) ? $groupCount : 1; $iLimit = ($multiplePlots) ? $groupCount : 1;
for($groupID = 0; $groupID < $iLimit; ++$groupID) { for($groupID = 0; $groupID < $iLimit; ++$groupID) {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); $exploded = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
if ($groupID == 0) { if ($groupID == 0) {
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount()); $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) { if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount); $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
} }
} }
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array(); $seriesPlots = array();
// For pie charts, we only display the first series: doughnut charts generally display all series // For pie charts, we only display the first series: doughnut charts generally display all series
$jLimit = ($multiplePlots) ? $seriesCount : 1; $jLimit = ($multiplePlots) ? $seriesCount : 1;
// Loop through each data series in turn // Loop through each data series in turn
for($j = 0; $j < $jLimit; ++$j) { for($j = 0; $j < $jLimit; ++$j) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues(); $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
// Fill in any missing values in the $dataValues array // Fill in any missing values in the $dataValues array
$testCurrentIndex = 0; $testCurrentIndex = 0;
@ -666,7 +658,7 @@ class PHPExcel_Chart_Renderer_jpgraph
$seriesPlot->SetMidColor('white'); $seriesPlot->SetMidColor('white');
} }
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]); $seriesPlot->SetColor(self::$colourSet[self::$_plotColour++]);
if (count($datasetLabels) > 0) if (count($datasetLabels) > 0)
$seriesPlot->SetLabels(array_fill(0,count($datasetLabels),'')); $seriesPlot->SetLabels(array_fill(0,count($datasetLabels),''));
if ($dimensions != '3d') { if ($dimensions != '3d') {
@ -679,7 +671,7 @@ class PHPExcel_Chart_Renderer_jpgraph
$seriesPlot->SetLegends($datasetLabels); $seriesPlot->SetLegends($datasetLabels);
} }
$this->_graph->Add($seriesPlot); $this->graph->Add($seriesPlot);
} }
} }
} // function _renderPieChart() } // function _renderPieChart()
@ -729,7 +721,7 @@ class PHPExcel_Chart_Renderer_jpgraph
for($i = 0; $i < $groupCount; ++$i) { for($i = 0; $i < $groupCount; ++$i) {
$dimensions = null; $dimensions = null;
$chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); $chartType = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
switch ($chartType) { switch ($chartType) {
case 'area3DChart' : case 'area3DChart' :
$dimensions = '3d'; $dimensions = '3d';
@ -753,14 +745,14 @@ class PHPExcel_Chart_Renderer_jpgraph
$this->_renderPlotScatter($i,true); $this->_renderPlotScatter($i,true);
break; break;
default : default :
$this->_graph = null; $this->graph = null;
return false; return false;
} }
} }
$this->_renderLegend(); $this->_renderLegend();
$this->_graph->Stroke($outputDestination); $this->graph->Stroke($outputDestination);
return true; return true;
} // function _renderCombinationChart() } // function _renderCombinationChart()
@ -768,15 +760,15 @@ class PHPExcel_Chart_Renderer_jpgraph
public function render($outputDestination) { public function render($outputDestination) {
self::$_plotColour = 0; self::$_plotColour = 0;
$groupCount = $this->_chart->getPlotArea()->getPlotGroupCount(); $groupCount = $this->chart->getPlotArea()->getPlotGroupCount();
$dimensions = null; $dimensions = null;
if ($groupCount == 1) { if ($groupCount == 1) {
$chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); $chartType = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
} else { } else {
$chartTypes = array(); $chartTypes = array();
for($i = 0; $i < $groupCount; ++$i) { for($i = 0; $i < $groupCount; ++$i) {
$chartTypes[] = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); $chartTypes[] = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
} }
$chartTypes = array_unique($chartTypes); $chartTypes = array_unique($chartTypes);
if (count($chartTypes) == 1) { if (count($chartTypes) == 1) {
@ -838,9 +830,9 @@ class PHPExcel_Chart_Renderer_jpgraph
} }
$this->_renderLegend(); $this->_renderLegend();
$this->_graph->Stroke($outputDestination); $this->graph->Stroke($outputDestination);
return true; return true;
} // function render() }
/** /**
@ -848,8 +840,7 @@ class PHPExcel_Chart_Renderer_jpgraph
*/ */
public function __construct(PHPExcel_Chart $chart) public function __construct(PHPExcel_Chart $chart)
{ {
$this->_graph = null; $this->graph = null;
$this->_chart = $chart; $this->chart = $chart;
} // function __construct() }
}
} // PHPExcel_Chart_Renderer_jpgraph

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* PHPExcel * PHPExcel_Chart_Title
* *
* Copyright (c) 2006 - 2015 PHPExcel * Copyright (c) 2006 - 2015 PHPExcel
* *
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
/**
* PHPExcel_Chart_Title
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Title class PHPExcel_Chart_Title
{ {
@ -41,22 +33,22 @@ class PHPExcel_Chart_Title
* *
* @var string * @var string
*/ */
private $_caption = null; private $caption = null;
/** /**
* Title Layout * Title Layout
* *
* @var PHPExcel_Chart_Layout * @var PHPExcel_Chart_Layout
*/ */
private $_layout = null; private $layout = null;
/** /**
* Create a new PHPExcel_Chart_Title * Create a new PHPExcel_Chart_Title
*/ */
public function __construct($caption = null, PHPExcel_Chart_Layout $layout = null) public function __construct($caption = null, PHPExcel_Chart_Layout $layout = null)
{ {
$this->_caption = $caption; $this->caption = $caption;
$this->_layout = $layout; $this->layout = $layout;
} }
/** /**
@ -64,8 +56,9 @@ class PHPExcel_Chart_Title
* *
* @return string * @return string
*/ */
public function getCaption() { public function getCaption()
return $this->_caption; {
return $this->caption;
} }
/** /**
@ -74,8 +67,9 @@ class PHPExcel_Chart_Title
* @param string $caption * @param string $caption
* @return PHPExcel_Chart_Title * @return PHPExcel_Chart_Title
*/ */
public function setCaption($caption = null) { public function setCaption($caption = null)
$this->_caption = $caption; {
$this->caption = $caption;
return $this; return $this;
} }
@ -85,8 +79,8 @@ class PHPExcel_Chart_Title
* *
* @return PHPExcel_Chart_Layout * @return PHPExcel_Chart_Layout
*/ */
public function getLayout() { public function getLayout()
return $this->_layout; {
return $this->layout;
} }
} }