PlotArea.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /**
  3. * PHPExcel_Chart_PlotArea
  4. *
  5. * Copyright (c) 2006 - 2015 PHPExcel
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * @category PHPExcel
  22. * @package PHPExcel_Chart
  23. * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version ##VERSION##, ##DATE##
  26. */
  27. class PHPExcel_Chart_PlotArea
  28. {
  29. /**
  30. * PlotArea Layout
  31. *
  32. * @var PHPExcel_Chart_Layout
  33. */
  34. private $layout = null;
  35. /**
  36. * Plot Series
  37. *
  38. * @var array of PHPExcel_Chart_DataSeries
  39. */
  40. private $plotSeries = array();
  41. /**
  42. * Create a new PHPExcel_Chart_PlotArea
  43. */
  44. public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
  45. {
  46. $this->layout = $layout;
  47. $this->plotSeries = $plotSeries;
  48. }
  49. /**
  50. * Get Layout
  51. *
  52. * @return PHPExcel_Chart_Layout
  53. */
  54. public function getLayout()
  55. {
  56. return $this->layout;
  57. }
  58. /**
  59. * Get Number of Plot Groups
  60. *
  61. * @return array of PHPExcel_Chart_DataSeries
  62. */
  63. public function getPlotGroupCount()
  64. {
  65. return count($this->plotSeries);
  66. }
  67. /**
  68. * Get Number of Plot Series
  69. *
  70. * @return integer
  71. */
  72. public function getPlotSeriesCount()
  73. {
  74. $seriesCount = 0;
  75. foreach ($this->plotSeries as $plot) {
  76. $seriesCount += $plot->getPlotSeriesCount();
  77. }
  78. return $seriesCount;
  79. }
  80. /**
  81. * Get Plot Series
  82. *
  83. * @return array of PHPExcel_Chart_DataSeries
  84. */
  85. public function getPlotGroup()
  86. {
  87. return $this->plotSeries;
  88. }
  89. /**
  90. * Get Plot Series by Index
  91. *
  92. * @return PHPExcel_Chart_DataSeries
  93. */
  94. public function getPlotGroupByIndex($index)
  95. {
  96. return $this->plotSeries[$index];
  97. }
  98. /**
  99. * Set Plot Series
  100. *
  101. * @param [PHPExcel_Chart_DataSeries]
  102. * @return PHPExcel_Chart_PlotArea
  103. */
  104. public function setPlotSeries($plotSeries = array())
  105. {
  106. $this->plotSeries = $plotSeries;
  107. return $this;
  108. }
  109. public function refresh(PHPExcel_Worksheet $worksheet)
  110. {
  111. foreach ($this->plotSeries as $plotSeries) {
  112. $plotSeries->refresh($worksheet);
  113. }
  114. }
  115. }