I am using PHPExcel for generating charts in Excel Files. I have some question whoes answer I couldn't find even after lot of R&D those are
- How can I show data labels to chart?
- How can I control the width of bar charts?
- How can I customize colors of bar charts?
I tried to show labels with layout class like :
$layout = new PHPExcel_Chart_Layout();
$layout->setShowVal(TRUE);
But no success.
I have also explored DataSeries
class and Chart
Class but couldn't find any solution. Any body here who have already done such tasks, Please guide.
Best Regards.
With this:
$dataseriesLabels = array(
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1),
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1),
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1),
);
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
range(0, count($dataSeriesValues)-1), // plotOrder
$dataseriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
$dataSeriesValues // plotValues
);
- you can define the dataseriesLabels to use in your chart
- PHPExcel set default Column Width
- PhpExcel Bar Chart
Read my answer there may be it will help with charts
and yes better to create what you need and than use it with load and save(as template)
PHPExcel removes chart style when template is loaded