Example #1
0
 /**
  * Add chart
  *
  * @param PHPExcel_Chart $pChart
  * @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last)
  * @return PHPExcel_Chart
  */
 public function addChart(PHPExcel_Chart $pChart = null, $iChartIndex = null)
 {
     $pChart->setWorksheet($this);
     if (is_null($iChartIndex)) {
         $this->_chartCollection[] = $pChart;
     } else {
         // Insert the chart at the requested index
         array_splice($this->_chartCollection, $iChartIndex, 0, array($pChart));
     }
     return $pChart;
 }