PlotArea.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. /**
  3. * PHPExcel
  4. *
  5. * Copyright (c) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version 1.7.9, 2013-06-02
  26. */
  27. /**
  28. * PHPExcel_Chart_PlotArea
  29. *
  30. * @category PHPExcel
  31. * @package PHPExcel_Chart
  32. * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
  33. */
  34. class PHPExcel_Chart_PlotArea
  35. {
  36. /**
  37. * PlotArea Layout
  38. *
  39. * @var PHPExcel_Chart_Layout
  40. */
  41. private $_layout = null;
  42. /**
  43. * Plot Series
  44. *
  45. * @var array of PHPExcel_Chart_DataSeries
  46. */
  47. private $_plotSeries = array();
  48. /**
  49. * Create a new PHPExcel_Chart_PlotArea
  50. */
  51. public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
  52. {
  53. $this->_layout = $layout;
  54. $this->_plotSeries = $plotSeries;
  55. }
  56. /**
  57. * Get Layout
  58. *
  59. * @return PHPExcel_Chart_Layout
  60. */
  61. public function getLayout() {
  62. return $this->_layout;
  63. }
  64. /**
  65. * Get Number of Plot Groups
  66. *
  67. * @return array of PHPExcel_Chart_DataSeries
  68. */
  69. public function getPlotGroupCount() {
  70. return count($this->_plotSeries);
  71. }
  72. /**
  73. * Get Number of Plot Series
  74. *
  75. * @return integer
  76. */
  77. public function getPlotSeriesCount() {
  78. $seriesCount = 0;
  79. foreach($this->_plotSeries as $plot) {
  80. $seriesCount += $plot->getPlotSeriesCount();
  81. }
  82. return $seriesCount;
  83. }
  84. /**
  85. * Get Plot Series
  86. *
  87. * @return array of PHPExcel_Chart_DataSeries
  88. */
  89. public function getPlotGroup() {
  90. return $this->_plotSeries;
  91. }
  92. /**
  93. * Get Plot Series by Index
  94. *
  95. * @return PHPExcel_Chart_DataSeries
  96. */
  97. public function getPlotGroupByIndex($index) {
  98. return $this->_plotSeries[$index];
  99. }
  100. /**
  101. * Set Plot Series
  102. *
  103. * @param [PHPExcel_Chart_DataSeries]
  104. */
  105. public function setPlotSeries($plotSeries = array()) {
  106. $this->_plotSeries = $plotSeries;
  107. }
  108. public function refresh(PHPExcel_Worksheet $worksheet) {
  109. foreach($this->_plotSeries as $plotSeries) {
  110. $plotSeries->refresh($worksheet);
  111. }
  112. }
  113. }