PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.28k stars 3.43k forks source link

Chart read write HTML and PDF #2783

Closed ivangy closed 2 years ago

ivangy commented 2 years ago

This is:

- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

The pdf and html file with the charts

What is the current behavior?

32 Chart read write HTML 15:13:01 Load Test from Xlsx file 36writeLineChart1.xlsx 15:13:01 Iterate worksheets looking at the charts 15:13:01 Worksheet: Data 15:13:01 chart1 - "Sales" 15:13:01 15:13:01 lineChart Fatal error: Uncaught TypeError: JpGraphException::defaultHandler(): Argument #1 ($exception) must be of type Exception, Error given in C:\xampp.8.0.18\htdocs\phpexcel\vendor\jpgraph\jpgraph\lib\jpgraph\src\jpgraph_errhandler.inc.php:158 Stack trace: #0 [internal function]: JpGraphException::defaultHandler(Object(Error)) #1 {main} thrown in C:\xampp.8.0.18\htdocs\phpexcel\vendor\jpgraph\jpgraph\lib\jpgraph\src\jpgraph_errhandler.inc.php on line 158

32 Chart read write PDF 15:07:46 Load Test from Xlsx file 36writeLineChart1.xlsx 15:07:46 Iterate worksheets looking at the charts 15:07:46 Worksheet: Data 15:07:46 chart1 - "Sales" 15:07:46 15:07:46 lineChart Fatal error: Uncaught TypeError: JpGraphException::defaultHandler(): Argument #1 ($exception) must be of type Exception, Error given in C:\xampp.8.0.18\htdocs\phpexcel\vendor\jpgraph\jpgraph\lib\jpgraph\src\jpgraph_errhandler.inc.php:158 Stack trace: #0 [internal function]: JpGraphException::defaultHandler(Object(Error)) #1 {main} thrown in C:\xampp.8.0.18\htdocs\phpexcel\vendor\jpgraph\jpgraph\lib\jpgraph\src\jpgraph_errhandler.inc.php on line 158

What are the steps to reproduce?

Run 32_Chart_read_write_HTML.php Run 32_Chart_read_write_PDF.php

What features do you think are causing the issue

php8.0 "phpoffice/phpspreadsheet": "^1.23", "mpdf/mpdf": "^8.1", "dompdf/dompdf": "^1.2", "tecnickcom/tcpdf": "^6.4", "jpgraph/jpgraph": "^4.0"

oleibman commented 2 years ago

Unfortunately, jpgraph is not maintained in composer. So the version that is installed "out of the box" with PhpSpreadsheet is a very old one, and results in the problem you are reporting. If you download the current version of jpgraph (4.4), and substitute that version in the vendor library, the sample scripts run correctly, without error or warnings messages. On my system, I discarded everything below vendor/jpgraph/jpgraph/lib/jpgraph (directory docs, directory src, and file VERSION), replacing them with docs, src, and VERSION from the current jpgraph image.

ivangy commented 2 years ago

thank you! <3

oleibman commented 2 years ago

We can now use mitoteam/jpgraph, which is maintained in Composer, in place of jpgraph/jpgraph. Closing this issue.