Skip to content

Commit 97381d4

Browse files
authored
Complete Support for Chart/Axis and Gridlines (#2881)
Unit testing now results in 100% coverage for Axis and Properties. All the properties in methods in Gridlines were more or less duplicated in Axis, and these duplications are moved to the common ancestor Properties. So, there isn't anything left in Gridlines. PhpSpreadsheet Chart is now over 85% covered (it was below 35% until recently). Properties are in many cases set to default to null/null-string, rather than the default values they receive from Excel, and are not written to Xml if unchanged. This is consistent with how Excel behaves. A new property `crossBetween` is added to Axis, and, with support for that added to Xlsx Reader and Writer, some minor Sample peculiarities are corrected, in particular, the charts were sometimes slightly truncated on the left and right edges.
1 parent 481cef2 commit 97381d4

File tree

8 files changed

+1301
-1111
lines changed

8 files changed

+1301
-1111
lines changed

phpstan-baseline.neon

-65
Original file line numberDiff line numberDiff line change
@@ -1170,46 +1170,6 @@ parameters:
11701170
count: 2
11711171
path: src/PhpSpreadsheet/Chart/DataSeries.php
11721172

1173-
-
1174-
message: "#^Parameter \\#1 \\$color of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setGlowColor\\(\\) expects string, string\\|null given\\.$#"
1175-
count: 1
1176-
path: src/PhpSpreadsheet/Chart/GridLines.php
1177-
1178-
-
1179-
message: "#^Parameter \\#2 \\$alpha of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setGlowColor\\(\\) expects int, int\\|null given\\.$#"
1180-
count: 1
1181-
path: src/PhpSpreadsheet/Chart/GridLines.php
1182-
1183-
-
1184-
message: "#^Parameter \\#3 \\$colorType of method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:setGlowColor\\(\\) expects string, string\\|null given\\.$#"
1185-
count: 1
1186-
path: src/PhpSpreadsheet/Chart/GridLines.php
1187-
1188-
-
1189-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$glowProperties has no type specified\\.$#"
1190-
count: 1
1191-
path: src/PhpSpreadsheet/Chart/GridLines.php
1192-
1193-
-
1194-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$lineProperties has no type specified\\.$#"
1195-
count: 1
1196-
path: src/PhpSpreadsheet/Chart/GridLines.php
1197-
1198-
-
1199-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$objectState has no type specified\\.$#"
1200-
count: 1
1201-
path: src/PhpSpreadsheet/Chart/GridLines.php
1202-
1203-
-
1204-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$shadowProperties has no type specified\\.$#"
1205-
count: 1
1206-
path: src/PhpSpreadsheet/Chart/GridLines.php
1207-
1208-
-
1209-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\GridLines\\:\\:\\$softEdges has no type specified\\.$#"
1210-
count: 1
1211-
path: src/PhpSpreadsheet/Chart/GridLines.php
1212-
12131173
-
12141174
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\:\\:\\$layout \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Layout\\|null\\.$#"
12151175
count: 1
@@ -4385,11 +4345,6 @@ parameters:
43854345
count: 1
43864346
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
43874347

4388-
-
4389-
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
4390-
count: 1
4391-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
4392-
43934348
-
43944349
message: "#^Parameter \\#1 \\$plotSeriesValues of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeBubbles\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|null, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|false given\\.$#"
43954350
count: 1
@@ -4400,16 +4355,6 @@ parameters:
44004355
count: 1
44014356
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
44024357

4403-
-
4404-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, array\\|int\\|string given\\.$#"
4405-
count: 2
4406-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
4407-
4408-
-
4409-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, array\\|int\\|string\\|null given\\.$#"
4410-
count: 1
4411-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
4412-
44134358
-
44144359
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, float given\\.$#"
44154360
count: 6
@@ -4425,11 +4370,6 @@ parameters:
44254370
count: 42
44264371
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
44274372

4428-
-
4429-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, string\\|null given\\.$#"
4430-
count: 2
4431-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
4432-
44334373
-
44344374
message: "#^Parameter \\#6 \\$yAxis of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeCategoryAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Axis\\|null given\\.$#"
44354375
count: 1
@@ -4450,11 +4390,6 @@ parameters:
44504390
count: 2
44514391
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
44524392

4453-
-
4454-
message: "#^Part \\$xAxis\\-\\>getShadowProperty\\(\\['color', 'type'\\]\\) \\(array\\|int\\|string\\|null\\) of encapsed string cannot be cast to string\\.$#"
4455-
count: 1
4456-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
4457-
44584393
-
44594394
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:\\$calculateCellValues has no type specified\\.$#"
44604395
count: 1

0 commit comments

Comments
 (0)