PhpExcel Bar Chart

此生再无相见时 提交于 2019-12-25 02:59:31

问题


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.


回答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




回答2:


$sheet->getStyle('A1')->applyFromArray(
    array(
        'fill' => array(
            'type' => PHPExcel_Style_Fill::FILL_SOLID,
            'color' => array('rgb' => 'FF0000')
        )
    )
);


来源:https://stackoverflow.com/questions/23243171/phpexcel-bar-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!