Jun 25, 2015 at 2:11 PM
Edited Jun 25, 2015 at 3:05 PM
I'm using PHPExcel library to generate scatter chart. I have 2 columns of value for example:
A | B | C
| 0 | 0
| 1 | 1
| 4 | 3
| 0 | 2
This values represent points which I would like to see on my chart. In Excel i can insert scatter char and select data as [SheetName]!$B$1:$C$4 and evrything works ok. Unfortunetly I can't do this in PHPExcel. Can You help me find bug in my code?
First I'm creating PHPExcel_Chart_DataSeriesValues like this:
$dataSeriesValues = array(
new PHPExcel_Chart_DataSeriesValues('Number', '!$B$1:$C$4', NULL, 4),
Next is PHPExcel_Chart_DataSeries:
$series = new PHPExcel_Chart_DataSeries(
range(0, count($dataSeriesValues) - 1),
And standart things like PHPExcel_Chart_PlotArea and PHPExcel_Chart:
$plotarea = new PHPExcel_Chart_PlotArea(NULL, array($series));
$chart = new PHPExcel_Chart(
There is 2 problems in my code:
- Something is wrong with my DataSeries - PHPExcel thinks that I have 8 points (1, 0), (2, 0), (3, 1), (4, 1), (5, 4), (6, 3), (7, 0), (8, 2). I have tried to add $plotCategory in PHPExcel_Chart_DataSeries but it didn't help.
- I would like to have only points on my chart but changing PHPExcel_Chart_DataSeries::STYLE_LINEMARKER on other possible option didn't change it anyway.
I hope my bad english is clear enough.