You are here

public function PHPExcel_Worksheet::addChart in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php \PHPExcel_Worksheet::addChart()

Add chart

Parameters

PHPExcel_Chart $pChart:

int|null $iChartIndex Index where chart should go (0,1,..., or null for last):

Return value

PHPExcel_Chart

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php, line 576

Class

PHPExcel_Worksheet
PHPExcel_Worksheet

Code

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;
}