Sitelet https://github.com/cesimarxavier/PHPExcel/commit/dc97d2f46b04be5e87a90eff770750fff8de02bc
Skip to content

Commit dc97d2f

Browse files
author
Mark Baker
committed
Improve fluent interface in charting methods
1 parent 19fc611 commit dc97d2f

5 files changed

Lines changed: 46 additions & 1 deletion

File tree

‎Classes/PHPExcel/Chart/DataSeries.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ public function getPlotType() {
170170
* Set Plot Type
171171
*
172172
* @param string $plotType
173+
* @return PHPExcel_Chart_DataSeries
173174
*/
174175
public function setPlotType($plotType = '') {
175176
$this->_plotType = $plotType;
177+
return $this;
176178
}
177179

178180
/**
@@ -188,9 +190,11 @@ public function getPlotGrouping() {
188190
* Set Plot Grouping Type
189191
*
190192
* @param string $groupingType
193+
* @return PHPExcel_Chart_DataSeries
191194
*/
192195
public function setPlotGrouping($groupingType = null) {
193196
$this->_plotGrouping = $groupingType;
197+
return $this;
194198
}
195199

196200
/**
@@ -206,9 +210,11 @@ public function getPlotDirection() {
206210
* Set Plot Direction
207211
*
208212
* @param string $plotDirection
213+
* @return PHPExcel_Chart_DataSeries
209214
*/
210215
public function setPlotDirection($plotDirection = null) {
211216
$this->_plotDirection = $plotDirection;
217+
return $this;
212218
}
213219

214220
/**
@@ -281,9 +287,11 @@ public function getPlotStyle() {
281287
* Set Plot Style
282288
*
283289
* @param string $plotStyle
290+
* @return PHPExcel_Chart_DataSeries
284291
*/
285292
public function setPlotStyle($plotStyle = null) {
286293
$this->_plotStyle = $plotStyle;
294+
return $this;
287295
}
288296

289297
/**
@@ -332,9 +340,11 @@ public function getSmoothLine() {
332340
* Set Smooth Line
333341
*
334342
* @param boolean $smoothLine
343+
* @return PHPExcel_Chart_DataSeries
335344
*/
336345
public function setSmoothLine($smoothLine = TRUE) {
337346
$this->_smoothLine = $smoothLine;
347+
return $this;
338348
}
339349

340350
public function refresh(PHPExcel_Worksheet $worksheet) {

‎Classes/PHPExcel/Chart/Layout.php‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,11 @@ public function getLayoutTarget() {
167167
* Set Layout Target
168168
*
169169
* @param Layout Target $value
170+
* @return PHPExcel_Chart_Layout
170171
*/
171172
public function setLayoutTarget($value) {
172173
$this->_layoutTarget = $value;
174+
return $this;
173175
}
174176

175177
/**
@@ -185,9 +187,11 @@ public function getXMode() {
185187
* Set X-Mode
186188
*
187189
* @param X-Mode $value
190+
* @return PHPExcel_Chart_Layout
188191
*/
189192
public function setXMode($value) {
190193
$this->_xMode = $value;
194+
return $this;
191195
}
192196

193197
/**
@@ -203,9 +207,11 @@ public function getYMode() {
203207
* Set Y-Mode
204208
*
205209
* @param Y-Mode $value
210+
* @return PHPExcel_Chart_Layout
206211
*/
207212
public function setYMode($value) {
208213
$this->_yMode = $value;
214+
return $this;
209215
}
210216

211217
/**
@@ -221,9 +227,11 @@ public function getXPosition() {
221227
* Set X-Position
222228
*
223229
* @param X-Position $value
230+
* @return PHPExcel_Chart_Layout
224231
*/
225232
public function setXPosition($value) {
226233
$this->_xPos = $value;
234+
return $this;
227235
}
228236

229237
/**
@@ -239,9 +247,11 @@ public function getYPosition() {
239247
* Set Y-Position
240248
*
241249
* @param Y-Position $value
250+
* @return PHPExcel_Chart_Layout
242251
*/
243252
public function setYPosition($value) {
244253
$this->_yPos = $value;
254+
return $this;
245255
}
246256

247257
/**
@@ -257,9 +267,11 @@ public function getWidth() {
257267
* Set Width
258268
*
259269
* @param Width $value
270+
* @return PHPExcel_Chart_Layout
260271
*/
261272
public function setWidth($value) {
262273
$this->_width = $value;
274+
return $this;
263275
}
264276

265277
/**
@@ -275,9 +287,11 @@ public function getHeight() {
275287
* Set Height
276288
*
277289
* @param Height $value
290+
* @return PHPExcel_Chart_Layout
278291
*/
279292
public function setHeight($value) {
280293
$this->_height = $value;
294+
return $this;
281295
}
282296

283297

@@ -295,9 +309,11 @@ public function getShowLegendKey() {
295309
* Specifies that legend keys should be shown in data labels.
296310
*
297311
* @param boolean $value Show legend key
312+
* @return PHPExcel_Chart_Layout
298313
*/
299314
public function setShowLegendKey($value) {
300315
$this->_showLegendKey = $value;
316+
return $this;
301317
}
302318

303319
/**
@@ -314,9 +330,11 @@ public function getShowVal() {
314330
* Specifies that the value should be shown in data labels.
315331
*
316332
* @param boolean $value Show val
333+
* @return PHPExcel_Chart_Layout
317334
*/
318335
public function setShowVal($value) {
319336
$this->_showVal = $value;
337+
return $this;
320338
}
321339

322340
/**
@@ -333,9 +351,11 @@ public function getShowCatName() {
333351
* Specifies that the category name should be shown in data labels.
334352
*
335353
* @param boolean $value Show cat name
354+
* @return PHPExcel_Chart_Layout
336355
*/
337356
public function setShowCatName($value) {
338357
$this->_showCatName = $value;
358+
return $this;
339359
}
340360

341361
/**
@@ -351,10 +371,12 @@ public function getShowSerName() {
351371
* Set show ser name
352372
* Specifies that the series name should be shown in data labels.
353373
*
354-
* @param boolean $value Show ser name
374+
* @param boolean $value Show series name
375+
* @return PHPExcel_Chart_Layout
355376
*/
356377
public function setShowSerName($value) {
357378
$this->_showSerName = $value;
379+
return $this;
358380
}
359381

360382
/**
@@ -371,9 +393,11 @@ public function getShowPercent() {
371393
* Specifies that the percentage should be shown in data labels.
372394
*
373395
* @param boolean $value Show percentage
396+
* @return PHPExcel_Chart_Layout
374397
*/
375398
public function setShowPercent($value) {
376399
$this->_showPercent = $value;
400+
return $this;
377401
}
378402

379403
/**
@@ -390,9 +414,11 @@ public function getShowBubbleSize() {
390414
* Specifies that the bubble size should be shown in data labels.
391415
*
392416
* @param boolean $value Show bubble size
417+
* @return PHPExcel_Chart_Layout
393418
*/
394419
public function setShowBubbleSize($value) {
395420
$this->_showBubbleSize = $value;
421+
return $this;
396422
}
397423

398424
/**
@@ -409,9 +435,11 @@ public function getShowLeaderLines() {
409435
* Specifies that leader lines should be shown in data labels.
410436
*
411437
* @param boolean $value Show leader lines
438+
* @return PHPExcel_Chart_Layout
412439
*/
413440
public function setShowLeaderLines($value) {
414441
$this->_showLeaderLines = $value;
442+
return $this;
415443
}
416444

417445
}

‎Classes/PHPExcel/Chart/PlotArea.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,12 @@ public function getPlotGroupByIndex($index) {
111111
* Set Plot Series
112112
*
113113
* @param [PHPExcel_Chart_DataSeries]
114+
* @return PHPExcel_Chart_PlotArea
114115
*/
115116
public function setPlotSeries($plotSeries = array()) {
116117
$this->_plotSeries = $plotSeries;
118+
119+
return $this;
117120
}
118121

119122
public function refresh(PHPExcel_Worksheet $worksheet) {

‎Classes/PHPExcel/Chart/Title.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,12 @@ public function getCaption() {
7272
* Set caption
7373
*
7474
* @param string $caption
75+
* @return PHPExcel_Chart_Title
7576
*/
7677
public function setCaption($caption = null) {
7778
$this->_caption = $caption;
79+
80+
return $this;
7881
}
7982

8083
/**

‎Examples/runall.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
, '34chartupdate.php'
9393
, '35chartrender.php'
9494
, '36chartreadwriteHTML.php'
95+
, '36chartreadwritePDF.php'
9596
, '37page_layout_view.php'
9697
, '38cloneWorksheet.php'
9798
, '40duplicateStyle.php'

0 commit comments

Comments
 (0)