Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Commit

Permalink
Improve fluent interface in charting methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Baker committed Dec 30, 2013
1 parent 19fc611 commit dc97d2f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Classes/PHPExcel/Chart/DataSeries.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ public function getPlotType() {
* Set Plot Type
*
* @param string $plotType
* @return PHPExcel_Chart_DataSeries
*/
public function setPlotType($plotType = '') {
$this->_plotType = $plotType;
return $this;
}

/**
Expand All @@ -188,9 +190,11 @@ public function getPlotGrouping() {
* Set Plot Grouping Type
*
* @param string $groupingType
* @return PHPExcel_Chart_DataSeries
*/
public function setPlotGrouping($groupingType = null) {
$this->_plotGrouping = $groupingType;
return $this;
}

/**
Expand All @@ -206,9 +210,11 @@ public function getPlotDirection() {
* Set Plot Direction
*
* @param string $plotDirection
* @return PHPExcel_Chart_DataSeries
*/
public function setPlotDirection($plotDirection = null) {
$this->_plotDirection = $plotDirection;
return $this;
}

/**
Expand Down Expand Up @@ -281,9 +287,11 @@ public function getPlotStyle() {
* Set Plot Style
*
* @param string $plotStyle
* @return PHPExcel_Chart_DataSeries
*/
public function setPlotStyle($plotStyle = null) {
$this->_plotStyle = $plotStyle;
return $this;
}

/**
Expand Down Expand Up @@ -332,9 +340,11 @@ public function getSmoothLine() {
* Set Smooth Line
*
* @param boolean $smoothLine
* @return PHPExcel_Chart_DataSeries
*/
public function setSmoothLine($smoothLine = TRUE) {
$this->_smoothLine = $smoothLine;
return $this;
}

public function refresh(PHPExcel_Worksheet $worksheet) {
Expand Down
30 changes: 29 additions & 1 deletion Classes/PHPExcel/Chart/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,11 @@ public function getLayoutTarget() {
* Set Layout Target
*
* @param Layout Target $value
* @return PHPExcel_Chart_Layout
*/
public function setLayoutTarget($value) {
$this->_layoutTarget = $value;
return $this;
}

/**
Expand All @@ -185,9 +187,11 @@ public function getXMode() {
* Set X-Mode
*
* @param X-Mode $value
* @return PHPExcel_Chart_Layout
*/
public function setXMode($value) {
$this->_xMode = $value;
return $this;
}

/**
Expand All @@ -203,9 +207,11 @@ public function getYMode() {
* Set Y-Mode
*
* @param Y-Mode $value
* @return PHPExcel_Chart_Layout
*/
public function setYMode($value) {
$this->_yMode = $value;
return $this;
}

/**
Expand All @@ -221,9 +227,11 @@ public function getXPosition() {
* Set X-Position
*
* @param X-Position $value
* @return PHPExcel_Chart_Layout
*/
public function setXPosition($value) {
$this->_xPos = $value;
return $this;
}

/**
Expand All @@ -239,9 +247,11 @@ public function getYPosition() {
* Set Y-Position
*
* @param Y-Position $value
* @return PHPExcel_Chart_Layout
*/
public function setYPosition($value) {
$this->_yPos = $value;
return $this;
}

/**
Expand All @@ -257,9 +267,11 @@ public function getWidth() {
* Set Width
*
* @param Width $value
* @return PHPExcel_Chart_Layout
*/
public function setWidth($value) {
$this->_width = $value;
return $this;
}

/**
Expand All @@ -275,9 +287,11 @@ public function getHeight() {
* Set Height
*
* @param Height $value
* @return PHPExcel_Chart_Layout
*/
public function setHeight($value) {
$this->_height = $value;
return $this;
}


Expand All @@ -295,9 +309,11 @@ public function getShowLegendKey() {
* Specifies that legend keys should be shown in data labels.
*
* @param boolean $value Show legend key
* @return PHPExcel_Chart_Layout
*/
public function setShowLegendKey($value) {
$this->_showLegendKey = $value;
return $this;
}

/**
Expand All @@ -314,9 +330,11 @@ public function getShowVal() {
* Specifies that the value should be shown in data labels.
*
* @param boolean $value Show val
* @return PHPExcel_Chart_Layout
*/
public function setShowVal($value) {
$this->_showVal = $value;
return $this;
}

/**
Expand All @@ -333,9 +351,11 @@ public function getShowCatName() {
* Specifies that the category name should be shown in data labels.
*
* @param boolean $value Show cat name
* @return PHPExcel_Chart_Layout
*/
public function setShowCatName($value) {
$this->_showCatName = $value;
return $this;
}

/**
Expand All @@ -351,10 +371,12 @@ public function getShowSerName() {
* Set show ser name
* Specifies that the series name should be shown in data labels.
*
* @param boolean $value Show ser name
* @param boolean $value Show series name
* @return PHPExcel_Chart_Layout
*/
public function setShowSerName($value) {
$this->_showSerName = $value;
return $this;
}

/**
Expand All @@ -371,9 +393,11 @@ public function getShowPercent() {
* Specifies that the percentage should be shown in data labels.
*
* @param boolean $value Show percentage
* @return PHPExcel_Chart_Layout
*/
public function setShowPercent($value) {
$this->_showPercent = $value;
return $this;
}

/**
Expand All @@ -390,9 +414,11 @@ public function getShowBubbleSize() {
* Specifies that the bubble size should be shown in data labels.
*
* @param boolean $value Show bubble size
* @return PHPExcel_Chart_Layout
*/
public function setShowBubbleSize($value) {
$this->_showBubbleSize = $value;
return $this;
}

/**
Expand All @@ -409,9 +435,11 @@ public function getShowLeaderLines() {
* Specifies that leader lines should be shown in data labels.
*
* @param boolean $value Show leader lines
* @return PHPExcel_Chart_Layout
*/
public function setShowLeaderLines($value) {
$this->_showLeaderLines = $value;
return $this;
}

}
3 changes: 3 additions & 0 deletions Classes/PHPExcel/Chart/PlotArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ public function getPlotGroupByIndex($index) {
* Set Plot Series
*
* @param [PHPExcel_Chart_DataSeries]
* @return PHPExcel_Chart_PlotArea
*/
public function setPlotSeries($plotSeries = array()) {
$this->_plotSeries = $plotSeries;

return $this;
}

public function refresh(PHPExcel_Worksheet $worksheet) {
Expand Down
3 changes: 3 additions & 0 deletions Classes/PHPExcel/Chart/Title.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ public function getCaption() {
* Set caption
*
* @param string $caption
* @return PHPExcel_Chart_Title
*/
public function setCaption($caption = null) {
$this->_caption = $caption;

return $this;
}

/**
Expand Down
1 change: 1 addition & 0 deletions Examples/runall.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
, '34chartupdate.php'
, '35chartrender.php'
, '36chartreadwriteHTML.php'
, '36chartreadwritePDF.php'
, '37page_layout_view.php'
, '38cloneWorksheet.php'
, '40duplicateStyle.php'
Expand Down

0 comments on commit dc97d2f

Please sign in to comment.