Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to send worksheet data static in PHPExcel chart

Tags:

php

phpexcel

i took example from 33chartcreate-pie.php from PHPExcel-1.8 and changing according to my need. now that example have x-axis value like.

$xAxisTickValues1 = array(
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4),  //  Q1 to Q4
);

now, i want add it static as PASS and FAIL so, i try it like

$xAxisTickValues1 = array(
new PHPExcel_Chart_DataSeriesValues('String', 'PASS:FAIL', NULL, 2),    //  Q1 to Q4
);

but, it is not working. how to put static value in that array?

like image 923
Divyesh Jesadiya Avatar asked Mar 02 '17 16:03

Divyesh Jesadiya


1 Answers

The example which you follow :

$xAxisTickValues1 = array(
new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4),  //  Q1 to Q4
);

Here Worksheet is the title of the sheet. So while plotting graph it will read value from the specified title followed by Columns as A2 to A5.

If you simply want to add static value. Create cell with static content in it and pass the cell index to data series values.

like image 136
rajatsaurastri Avatar answered Oct 30 '22 13:10

rajatsaurastri