1

I want to change the color of each bar in my bar chart , the chart is like: There are four products product 1 product 2 product 3 product 4

There are two bars for each product, one is total value and one is overall value. Total value should have Black color. overall value should according to its product. Right now its coming only two colors Blue for total value red for overall value.

So please help me for creating such bar chart who has different colors for different product.

Thanks in Advance.

Raj
  • 419
  • 1
  • 4
  • 10

2 Answers2

1

At the moment, PHPExcel charts don't support customised colours for dataseries, but only uses MS Excel's varyColors's option.

As for alternatives, there is no other PHP library that supports Excel charts; but you can do so using COM (if you're running on Windows), PUNO with Open/Libre Office, or (I believe) Ilia Alshanetsky's PHP extension for libXL

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • Thanks, but not useful for me, as my whole excel report is ready from that excel i have created bar charts but problem with colors only :( Hope fully i ll get solution in upcoming versions of phpexcel – Raj Apr 24 '14 at 07:06
-2
$sheet->getStyle('A1')->applyFromArray(
    array(
        'fill' => array(
            'type' => PHPExcel_Style_Fill::FILL_SOLID,
            'color' => array('rgb' => 'FF0000')
        )
    )
);
  • Thanks but this will color the one cell only, i dont think so it will help me in changing color of bar charts. – Raj Apr 23 '14 at 12:13