How to change colour of the PHPPowerPoint_Shape_Chart_Type_Line series?

Dec 19, 2012 at 12:19 PM

Hello.

I'm trying to apply different colors for the line chart but always having default colors for the PHPPowerPoint_Shape_Chart_Type_Line, PHPPowerPoint_Shape_Chart_Type_Scatter. At the same time PHPPowerPoint_Shape_Chart_Type_Bar3D works as expected.

Here is my code:

//$objChart = new PHPPowerPoint_Shape_Chart_Type_Bar3D();
    $objChart = new PHPPowerPoint_Shape_Chart_Type_Line();
    for($i=0;$i<count($chartData['series']);$i++){
        if(isset($chartData['series'][$i]['data'])){
            $series = new PHPPowerPoint_Shape_Chart_Series($chartData['series'][$i]['legend'][0], $chartData['series'][$i]['data']);
            $series->setShowSeriesName(false);
            if(isset($chartData['series'][$i]['color'])){
                $series->getFill()
                        ->setFillType(PHPPowerPoint_Style_Fill::FILL_SOLID)
                        ->setStartColor(new PHPPowerPoint_Style_Color($chartData['series'][$i]['color']));
            }
            $objChart->addSeries($series);
            $shape->getPlotArea()->getAxisX()->setTitle($chartData['series'][$i]['legend'][0]);
            $shape->getPlotArea()->getAxisY()->setTitle($chartData['series'][$i]['legend'][1]);
        }
    }

 

Thanks in advance.