Sure:
$series = array(); for ($r = 11; $r <= 16; $r++) { $label = new PHPExcel_Chart_DataSeriesValues('String', 'A'.$r,null,1); $value = new PHPExcel_Chart_DataSeriesValues('Number', 'D'.$r,null,1); $series[count($series)] = new PHPExcel_Chart_DataSeries( PHPExcel_Chart_DataSeries::TYPE_BARCHART , PHPExcel_Chart_DataSeries::GROUPING_STACKED , array(0) , array($label) , null , array($value) ); $series[count($series)-1]->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_BAR); } $label = new PHPExcel_Chart_DataSeriesValues('String', 'A4',null,1); $value = new PHPExcel_Chart_DataSeriesValues('Number', 'G4',null,1); $series[count($series)] = new PHPExcel_Chart_DataSeries( PHPExcel_Chart_DataSeries::TYPE_BARCHART , PHPExcel_Chart_DataSeries::GROUPING_STACKED , array(0) , array($label) , null , array($value) ); $series[count($series)-1]->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_BAR); $layout = new PHPExcel_Chart_Layout(); $plotarea = new PHPExcel_Chart_PlotArea($layout, $series) ; $legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, null, false); $chart = new PHPExcel_Chart( $title , null , $legend , $plotarea , true , 0 , null , null ); $chart->setTopLeftPosition('A'.($mr+2)); $chart->setBottomRightPosition('K'.($mr+22)); $sheet->addChart($chart);
Thanks.
mfg Tobias