-
Notifications
You must be signed in to change notification settings - Fork 4.2k
PHP Excel Radar and Scatter charts won't open in Excel 2007 #956
Comments
Similar to this issue: #645 but that reports that it is fixed but it isn't for Excel 2007. |
I was experiencing the same issues with my scatterplots. I think I found a solution to it: In $series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART, // plotType
NULL, // plotGrouping (Scatter charts don't have any grouping)
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
$dataSeriesValues, // plotValues
NULL, // smooth line
PHPExcel_Chart_DataSeries::STYLE_LINEMARKER // plotStyle
); However, if you look in the source code public function __construct(
$plotType = null,
$plotGrouping = null,
$plotOrder = array(),
$plotLabel = array(),
$plotCategory = array(),
$plotValues = array(),
$plotDirection = null,
$smoothLine = null,
$plotStyle = null)
{
/* The constructor code */
} So if you update your $series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART, // plotType
NULL, // plotGrouping (Scatter charts don't have any grouping)
range(0, count($dataSeriesValues)-1), // plotOrder
$dataSeriesLabels, // plotLabel
$xAxisTickValues, // plotCategory
$dataSeriesValues, // plotValues
NULL, // plotDirection
NULL, // smooth line
PHPExcel_Chart_DataSeries::STYLE_LINEMARKER // plotStyle
); I quickly looked at |
Great stuff @TheoBaart can't believe I missed that! I burnt about 8 hours looking in the end.. frustratingly it was opening in OpenOffice so I was looking way deeper than just the example in the source code file being fundamentally wrong! |
p.s. to anyone else reading this obviously change: $series = new PHPExcel_Chart_DataSeries( to $series = new PHPExcel_Chart_DataSeries( If you want a RADAR chart. then include the extra NULL in the constructor before as thoebaart pointed out. Then it should all work. |
Thanks for identifying that problem; I've fixed it in the develop branch on github |
Running the default origin/1.8 develop/1.8 example file 33-createdchart-radar.php from linux PHP 5.6, windows PHP 5.6 and macos PHP5.6 and PHP7 throws an error.
All these environments at least create an error in Excel when opening the file:
"Excel found unreadable content in'file.xlsx'. Do you want to recover the contents of this workbook?"
If you click Yes you get the result of another error:
"Repaired records: Drawing from /xl/drawings/drawing1.xml part (drawing shape).
When the xlsx file open ups you get the "Test Radar Chart" from 0 to 1.5 but with no data points plotted.
The file opens correctly on Open Office.
The log files for the repairs is as follows:
error087680_01.xml
Errors were detected in file 'C:\Users\Pete\Sites\File.xlsx'
Repaired Records: Drawing from /xl/drawings/drawing1.xml part (Drawing shape)
Any assistance appreciated. All the files you will need to reproduce this issue are in the origin/1.8 as long as you open on Excel 2007 you will see the problem. There are various reports on stackover flow to this problem but none present a solution.
Extra info: I tried useing jpgraph to create the radar chart but it errors with a:
"JPGraph Error: 25044 = Cannot use auto scaling since it is impossible to determine a valid min/max value of the y axis (only null values)."
unless I output the chart first into the worksheet in which case it will then run.
The text was updated successfully, but these errors were encountered: