See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Chart; 4 5 class Layout 6 { 7 /** 8 * layoutTarget. 9 * 10 * @var string 11 */ 12 private $layoutTarget; 13 14 /** 15 * X Mode. 16 * 17 * @var string 18 */ 19 private $xMode; 20 21 /** 22 * Y Mode. 23 * 24 * @var string 25 */ 26 private $yMode; 27 28 /** 29 * X-Position. 30 * 31 * @var float 32 */ 33 private $xPos; 34 35 /** 36 * Y-Position. 37 * 38 * @var float 39 */ 40 private $yPos; 41 42 /** 43 * width. 44 * 45 * @var float 46 */ 47 private $width; 48 49 /** 50 * height. 51 * 52 * @var float 53 */ 54 private $height; 55 56 /** 57 * Position - t=top. 58 * 59 * @var string 60 */ 61 private $dLblPos = ''; 62 63 /** @var string */ 64 private $numFmtCode = ''; 65 66 /** @var bool */ 67 private $numFmtLinked = false; 68 69 /** 70 * show legend key 71 * Specifies that legend keys should be shown in data labels. 72 * 73 * @var ?bool 74 */ 75 private $showLegendKey; 76 77 /** 78 * show value 79 * Specifies that the value should be shown in a data label. 80 * 81 * @var ?bool 82 */ 83 private $showVal; 84 85 /** 86 * show category name 87 * Specifies that the category name should be shown in the data label. 88 * 89 * @var ?bool 90 */ 91 private $showCatName; 92 93 /** 94 * show data series name 95 * Specifies that the series name should be shown in the data label. 96 * 97 * @var ?bool 98 */ 99 private $showSerName; 100 101 /** 102 * show percentage 103 * Specifies that the percentage should be shown in the data label. 104 * 105 * @var ?bool 106 */ 107 private $showPercent; 108 109 /** 110 * show bubble size. 111 * 112 * @var ?bool 113 */ 114 private $showBubbleSize; 115 116 /** 117 * show leader lines 118 * Specifies that leader lines should be shown for the data label. 119 * 120 * @var ?bool 121 */ 122 private $showLeaderLines; 123 124 /** @var ?ChartColor */ 125 private $labelFillColor; 126 127 /** @var ?ChartColor */ 128 private $labelBorderColor; 129 130 /** @var ?ChartColor */ 131 private $labelFontColor; 132 133 /** 134 * Create a new Layout. 135 */ 136 public function __construct(array $layout = []) 137 { 138 if (isset($layout['layoutTarget'])) { 139 $this->layoutTarget = $layout['layoutTarget']; 140 } 141 if (isset($layout['xMode'])) { 142 $this->xMode = $layout['xMode']; 143 } 144 if (isset($layout['yMode'])) { 145 $this->yMode = $layout['yMode']; 146 } 147 if (isset($layout['x'])) { 148 $this->xPos = (float) $layout['x']; 149 } 150 if (isset($layout['y'])) { 151 $this->yPos = (float) $layout['y']; 152 } 153 if (isset($layout['w'])) { 154 $this->width = (float) $layout['w']; 155 } 156 if (isset($layout['h'])) { 157 $this->height = (float) $layout['h']; 158 } 159 if (isset($layout['dLblPos'])) { 160 $this->dLblPos = (string) $layout['dLblPos']; 161 } 162 if (isset($layout['numFmtCode'])) { 163 $this->numFmtCode = (string) $layout['numFmtCode']; 164 } 165 $this->initBoolean($layout, 'showLegendKey'); 166 $this->initBoolean($layout, 'showVal'); 167 $this->initBoolean($layout, 'showCatName'); 168 $this->initBoolean($layout, 'showSerName'); 169 $this->initBoolean($layout, 'showPercent'); 170 $this->initBoolean($layout, 'showBubbleSize'); 171 $this->initBoolean($layout, 'showLeaderLines'); 172 $this->initBoolean($layout, 'numFmtLinked'); 173 $this->initColor($layout, 'labelFillColor'); 174 $this->initColor($layout, 'labelBorderColor'); 175 $this->initColor($layout, 'labelFontColor'); 176 } 177 178 private function initBoolean(array $layout, string $name): void 179 { 180 if (isset($layout[$name])) { 181 $this->$name = (bool) $layout[$name]; 182 } 183 } 184 185 private function initColor(array $layout, string $name): void 186 { 187 if (isset($layout[$name]) && $layout[$name] instanceof ChartColor) { 188 $this->$name = $layout[$name]; 189 } 190 } 191 192 /** 193 * Get Layout Target. 194 * 195 * @return string 196 */ 197 public function getLayoutTarget() 198 { 199 return $this->layoutTarget; 200 } 201 202 /** 203 * Set Layout Target. 204 * 205 * @param string $target 206 * 207 * @return $this 208 */ 209 public function setLayoutTarget($target) 210 { 211 $this->layoutTarget = $target; 212 213 return $this; 214 } 215 216 /** 217 * Get X-Mode. 218 * 219 * @return string 220 */ 221 public function getXMode() 222 { 223 return $this->xMode; 224 } 225 226 /** 227 * Set X-Mode. 228 * 229 * @param string $mode 230 * 231 * @return $this 232 */ 233 public function setXMode($mode) 234 { 235 $this->xMode = (string) $mode; 236 237 return $this; 238 } 239 240 /** 241 * Get Y-Mode. 242 * 243 * @return string 244 */ 245 public function getYMode() 246 { 247 return $this->yMode; 248 } 249 250 /** 251 * Set Y-Mode. 252 * 253 * @param string $mode 254 * 255 * @return $this 256 */ 257 public function setYMode($mode) 258 { 259 $this->yMode = (string) $mode; 260 261 return $this; 262 } 263 264 /** 265 * Get X-Position. 266 * 267 * @return number 268 */ 269 public function getXPosition() 270 { 271 return $this->xPos; 272 } 273 274 /** 275 * Set X-Position. 276 * 277 * @param float $position 278 * 279 * @return $this 280 */ 281 public function setXPosition($position) 282 { 283 $this->xPos = (float) $position; 284 285 return $this; 286 } 287 288 /** 289 * Get Y-Position. 290 * 291 * @return number 292 */ 293 public function getYPosition() 294 { 295 return $this->yPos; 296 } 297 298 /** 299 * Set Y-Position. 300 * 301 * @param float $position 302 * 303 * @return $this 304 */ 305 public function setYPosition($position) 306 { 307 $this->yPos = (float) $position; 308 309 return $this; 310 } 311 312 /** 313 * Get Width. 314 * 315 * @return number 316 */ 317 public function getWidth() 318 { 319 return $this->width; 320 } 321 322 /** 323 * Set Width. 324 * 325 * @param float $width 326 * 327 * @return $this 328 */ 329 public function setWidth($width) 330 { 331 $this->width = $width; 332 333 return $this; 334 } 335 336 /** 337 * Get Height. 338 * 339 * @return number 340 */ 341 public function getHeight() 342 { 343 return $this->height; 344 } 345 346 /** 347 * Set Height. 348 * 349 * @param float $height 350 * 351 * @return $this 352 */ 353 public function setHeight($height) 354 { 355 $this->height = $height; 356 357 return $this; 358 } 359 360 public function getShowLegendKey(): ?bool 361 { 362 return $this->showLegendKey; 363 } 364 365 /** 366 * Set show legend key 367 * Specifies that legend keys should be shown in data labels. 368 */ 369 public function setShowLegendKey(?bool $showLegendKey): self 370 { 371 $this->showLegendKey = $showLegendKey; 372 373 return $this; 374 } 375 376 public function getShowVal(): ?bool 377 { 378 return $this->showVal; 379 } 380 381 /** 382 * Set show val 383 * Specifies that the value should be shown in data labels. 384 */ 385 public function setShowVal(?bool $showDataLabelValues): self 386 { 387 $this->showVal = $showDataLabelValues; 388 389 return $this; 390 } 391 392 public function getShowCatName(): ?bool 393 { 394 return $this->showCatName; 395 } 396 397 /** 398 * Set show cat name 399 * Specifies that the category name should be shown in data labels. 400 */ 401 public function setShowCatName(?bool $showCategoryName): self 402 { 403 $this->showCatName = $showCategoryName; 404 405 return $this; 406 } 407 408 public function getShowSerName(): ?bool 409 { 410 return $this->showSerName; 411 } 412 413 /** 414 * Set show data series name. 415 * Specifies that the series name should be shown in data labels. 416 */ 417 public function setShowSerName(?bool $showSeriesName): self 418 { 419 $this->showSerName = $showSeriesName; 420 421 return $this; 422 } 423 424 public function getShowPercent(): ?bool 425 { 426 return $this->showPercent; 427 } 428 429 /** 430 * Set show percentage. 431 * Specifies that the percentage should be shown in data labels. 432 */ 433 public function setShowPercent(?bool $showPercentage): self 434 { 435 $this->showPercent = $showPercentage; 436 437 return $this; 438 } 439 440 public function getShowBubbleSize(): ?bool 441 { 442 return $this->showBubbleSize; 443 } 444 445 /** 446 * Set show bubble size. 447 * Specifies that the bubble size should be shown in data labels. 448 */ 449 public function setShowBubbleSize(?bool $showBubbleSize): self 450 { 451 $this->showBubbleSize = $showBubbleSize; 452 453 return $this; 454 } 455 456 public function getShowLeaderLines(): ?bool 457 { 458 return $this->showLeaderLines; 459 } 460 461 /** 462 * Set show leader lines. 463 * Specifies that leader lines should be shown in data labels. 464 */ 465 public function setShowLeaderLines(?bool $showLeaderLines): self 466 { 467 $this->showLeaderLines = $showLeaderLines; 468 469 return $this; 470 } 471 472 public function getLabelFillColor(): ?ChartColor 473 { 474 return $this->labelFillColor; 475 } 476 477 public function setLabelFillColor(?ChartColor $chartColor): self 478 { 479 $this->labelFillColor = $chartColor; 480 481 return $this; 482 } 483 484 public function getLabelBorderColor(): ?ChartColor 485 { 486 return $this->labelBorderColor; 487 } 488 489 public function setLabelBorderColor(?ChartColor $chartColor): self 490 { 491 $this->labelBorderColor = $chartColor; 492 493 return $this; 494 } 495 496 public function getLabelFontColor(): ?ChartColor 497 { 498 return $this->labelFontColor; 499 } 500 501 public function setLabelFontColor(?ChartColor $chartColor): self 502 { 503 $this->labelFontColor = $chartColor; 504 505 return $this; 506 } 507 508 public function getDLblPos(): string 509 { 510 return $this->dLblPos; 511 } 512 513 public function setDLblPos(string $dLblPos): self 514 { 515 $this->dLblPos = $dLblPos; 516 517 return $this; 518 } 519 520 public function getNumFmtCode(): string 521 { 522 return $this->numFmtCode; 523 } 524 525 public function setNumFmtCode(string $numFmtCode): self 526 { 527 $this->numFmtCode = $numFmtCode; 528 529 return $this; 530 } 531 532 public function getNumFmtLinked(): bool 533 { 534 return $this->numFmtLinked; 535 } 536 537 public function setNumFmtLinked(bool $numFmtLinked): self 538 { 539 $this->numFmtLinked = $numFmtLinked; 540 541 return $this; 542 } 543 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body