_plotType = $plotType; $this->_plotGrouping = $plotGrouping; $this->_plotOrder = $plotOrder; $keys = array_keys($plotValues); $this->_plotValues = $plotValues; if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) { $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); } $this->_plotLabel = $plotLabel; if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) { $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues(); } $this->_plotCategory = $plotCategory; $this->_smoothLine = $smoothLine; $this->_plotStyle = $plotStyle; if (is_null($plotDirection)) { $plotDirection = self::DIRECTION_COL; } $this->_plotDirection = $plotDirection; } /** * Get Plot Type * * @return string */ public function getPlotType() { return $this->_plotType; } /** * Set Plot Type * * @param string $plotType * @return PHPExcel_Chart_DataSeries */ public function setPlotType($plotType = '') { $this->_plotType = $plotType; return $this; } /** * Get Plot Grouping Type * * @return string */ public function getPlotGrouping() { return $this->_plotGrouping; } /** * Set Plot Grouping Type * * @param string $groupingType * @return PHPExcel_Chart_DataSeries */ public function setPlotGrouping($groupingType = null) { $this->_plotGrouping = $groupingType; return $this; } /** * Get Plot Direction * * @return string */ public function getPlotDirection() { return $this->_plotDirection; } /** * Set Plot Direction * * @param string $plotDirection * @return PHPExcel_Chart_DataSeries */ public function setPlotDirection($plotDirection = null) { $this->_plotDirection = $plotDirection; return $this; } /** * Get Plot Order * * @return string */ public function getPlotOrder() { return $this->_plotOrder; } /** * Get Plot Labels * * @return array of PHPExcel_Chart_DataSeriesValues */ public function getPlotLabels() { return $this->_plotLabel; } /** * Get Plot Label by Index * * @return PHPExcel_Chart_DataSeriesValues */ public function getPlotLabelByIndex($index) { $keys = array_keys($this->_plotLabel); if (in_array($index, $keys)) { return $this->_plotLabel[$index]; } elseif (isset($keys[$index])) { return $this->_plotLabel[$keys[$index]]; } return false; } /** * Get Plot Categories * * @return array of PHPExcel_Chart_DataSeriesValues */ public function getPlotCategories() { return $this->_plotCategory; } /** * Get Plot Category by Index * * @return PHPExcel_Chart_DataSeriesValues */ public function getPlotCategoryByIndex($index) { $keys = array_keys($this->_plotCategory); if (in_array($index, $keys)) { return $this->_plotCategory[$index]; } elseif (isset($keys[$index])) { return $this->_plotCategory[$keys[$index]]; } return false; } /** * Get Plot Style * * @return string */ public function getPlotStyle() { return $this->_plotStyle; } /** * Set Plot Style * * @param string $plotStyle * @return PHPExcel_Chart_DataSeries */ public function setPlotStyle($plotStyle = null) { $this->_plotStyle = $plotStyle; return $this; } /** * Get Plot Values * * @return array of PHPExcel_Chart_DataSeriesValues */ public function getPlotValues() { return $this->_plotValues; } /** * Get Plot Values by Index * * @return PHPExcel_Chart_DataSeriesValues */ public function getPlotValuesByIndex($index) { $keys = array_keys($this->_plotValues); if (in_array($index, $keys)) { return $this->_plotValues[$index]; } elseif (isset($keys[$index])) { return $this->_plotValues[$keys[$index]]; } return false; } /** * Get Number of Plot Series * * @return integer */ public function getPlotSeriesCount() { return count($this->_plotValues); } /** * Get Smooth Line * * @return boolean */ public function getSmoothLine() { return $this->_smoothLine; } /** * 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) { foreach($this->_plotValues as $plotValues) { if ($plotValues !== null) { $plotValues->refresh($worksheet, true); } } foreach($this->_plotLabel as $plotValues) { if ($plotValues !== null) { $plotValues->refresh($worksheet, true); } } foreach($this->_plotCategory as $plotValues) { if ($plotValues !== null) { $plotValues->refresh($worksheet, false); } } } }