Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
<?php

namespace PhpOffice\PhpSpreadsheet\Chart;

> use PhpOffice\PhpSpreadsheet\Style\Font; class Layout >
{ /** * layoutTarget. *
< * @var string
> * @var ?string
*/ private $layoutTarget; /** * X Mode. *
< * @var string
> * @var ?string
*/ private $xMode; /** * Y Mode. *
< * @var string
> * @var ?string
*/ private $yMode; /** * X-Position. *
< * @var float
> * @var ?float
*/ private $xPos; /** * Y-Position. *
< * @var float
> * @var ?float
*/ private $yPos; /** * width. *
< * @var float
> * @var ?float
*/ private $width; /** * height. *
< * @var float
> * @var ?float
*/ private $height; /**
> * Position - t=top. * show legend key > * * Specifies that legend keys should be shown in data labels. > * @var string * > */ * @var bool > private $dLblPos = ''; */ > private $showLegendKey; > /** @var string */ > private $numFmtCode = ''; /** > * show value > /** @var bool */ * Specifies that the value should be shown in a data label. > private $numFmtLinked = false; * > * @var bool > /**
< * @var bool
> * @var ?bool
< * @var bool
> * @var ?bool
/** * show category name * Specifies that the category name should be shown in the data label. *
< * @var bool
> * @var ?bool
*/ private $showCatName; /** * show data series name * Specifies that the series name should be shown in the data label. *
< * @var bool
> * @var ?bool
*/ private $showSerName; /** * show percentage * Specifies that the percentage should be shown in the data label. *
< * @var bool
> * @var ?bool
*/ private $showPercent; /** * show bubble size. *
< * @var bool
> * @var ?bool
*/ private $showBubbleSize; /** * show leader lines * Specifies that leader lines should be shown for the data label. *
< * @var bool
> * @var ?bool
*/ private $showLeaderLines;
> /** @var ?ChartColor */ /** > private $labelFillColor; * Create a new Layout. > */ > /** @var ?ChartColor */ public function __construct(array $layout = []) > private $labelBorderColor; { > if (isset($layout['layoutTarget'])) { > /** @var ?Font */ $this->layoutTarget = $layout['layoutTarget']; > private $labelFont; } > if (isset($layout['xMode'])) { > /** @var Properties */ $this->xMode = $layout['xMode']; > private $labelEffects; } >
if (isset($layout['yMode'])) { $this->yMode = $layout['yMode']; } if (isset($layout['x'])) { $this->xPos = (float) $layout['x']; } if (isset($layout['y'])) { $this->yPos = (float) $layout['y']; } if (isset($layout['w'])) { $this->width = (float) $layout['w']; } if (isset($layout['h'])) { $this->height = (float) $layout['h']; }
> if (isset($layout['dLblPos'])) { } > $this->dLblPos = (string) $layout['dLblPos']; > } /** > if (isset($layout['numFmtCode'])) { * Get Layout Target. > $this->numFmtCode = (string) $layout['numFmtCode']; * > } * @return string > $this->initBoolean($layout, 'showLegendKey'); */ > $this->initBoolean($layout, 'showVal'); public function getLayoutTarget() > $this->initBoolean($layout, 'showCatName'); { > $this->initBoolean($layout, 'showSerName'); return $this->layoutTarget; > $this->initBoolean($layout, 'showPercent'); } > $this->initBoolean($layout, 'showBubbleSize'); > $this->initBoolean($layout, 'showLeaderLines'); /** > $this->initBoolean($layout, 'numFmtLinked'); * Set Layout Target. > $this->initColor($layout, 'labelFillColor'); * > $this->initColor($layout, 'labelBorderColor'); * @param string $value > $labelFont = $layout['labelFont'] ?? null; * > if ($labelFont instanceof Font) { * @return $this > $this->labelFont = $labelFont; */ > } public function setLayoutTarget($value) > $labelFontColor = $layout['labelFontColor'] ?? null; { > if ($labelFontColor instanceof ChartColor) { $this->layoutTarget = $value; > $this->setLabelFontColor($labelFontColor); > } return $this; > $labelEffects = $layout['labelEffects'] ?? null; } > if ($labelEffects instanceof Properties) { > $this->labelEffects = $labelEffects; /** > } * Get X-Mode. > } * > * @return string > private function initBoolean(array $layout, string $name): void */ > { public function getXMode() > if (isset($layout[$name])) { { > $this->$name = (bool) $layout[$name]; return $this->xMode; > } } > } > /** > private function initColor(array $layout, string $name): void * Set X-Mode. > { * > if (isset($layout[$name]) && $layout[$name] instanceof ChartColor) { * @param string $value > $this->$name = $layout[$name]; * > }
< * @return string
> * @return ?string
< * @param string $value
> * @param ?string $target
< public function setLayoutTarget($value)
> public function setLayoutTarget($target)
< $this->layoutTarget = $value;
> $this->layoutTarget = $target;
< * @return string
> * @return ?string
< * @param string $value
> * @param ?string $mode
< public function setXMode($value)
> public function setXMode($mode)
< $this->xMode = (string) $value;
> $this->xMode = (string) $mode;
/** * Get Y-Mode. *
< * @return string
> * @return ?string
*/ public function getYMode() { return $this->yMode; } /** * Set Y-Mode. *
< * @param string $value
> * @param ?string $mode
* * @return $this */
< public function setYMode($value)
> public function setYMode($mode)
{
< $this->yMode = (string) $value;
> $this->yMode = (string) $mode;
return $this; } /** * Get X-Position. *
< * @return number
> * @return null|float|int
*/ public function getXPosition() { return $this->xPos; } /** * Set X-Position. *
< * @param float $value
> * @param ?float $position
* * @return $this */
< public function setXPosition($value)
> public function setXPosition($position)
{
< $this->xPos = (float) $value;
> $this->xPos = (float) $position;
return $this; } /** * Get Y-Position. *
< * @return number
> * @return null|float
*/ public function getYPosition() { return $this->yPos; } /** * Set Y-Position. *
< * @param float $value
> * @param ?float $position
* * @return $this */
< public function setYPosition($value)
> public function setYPosition($position)
{
< $this->yPos = (float) $value;
> $this->yPos = (float) $position;
return $this; } /** * Get Width. *
< * @return number
> * @return ?float
*/ public function getWidth() { return $this->width; } /** * Set Width. *
< * @param float $value
> * @param ?float $width
* * @return $this */
< public function setWidth($value)
> public function setWidth($width)
{
< $this->width = $value;
> $this->width = $width;
return $this; } /** * Get Height. *
< * @return number
> * @return null|float
*/ public function getHeight() { return $this->height; } /** * Set Height. *
< * @param float $value
> * @param ?float $height
* * @return $this */
< public function setHeight($value)
> public function setHeight($height)
{
< $this->height = $value;
> $this->height = $height;
return $this; }
< /** < * Get show legend key. < * < * @return bool < */ < public function getShowLegendKey()
> public function getShowLegendKey(): ?bool
{ return $this->showLegendKey; } /** * Set show legend key * Specifies that legend keys should be shown in data labels.
< * < * @param bool $value Show legend key < * < * @return $this
*/
< public function setShowLegendKey($value)
> public function setShowLegendKey(?bool $showLegendKey): self
{
< $this->showLegendKey = $value;
> $this->showLegendKey = $showLegendKey;
return $this; }
< /** < * Get show value. < * < * @return bool < */ < public function getShowVal()
> public function getShowVal(): ?bool
{ return $this->showVal; } /** * Set show val * Specifies that the value should be shown in data labels.
< * < * @param bool $value Show val < * < * @return $this
*/
< public function setShowVal($value)
> public function setShowVal(?bool $showDataLabelValues): self
{
< $this->showVal = $value;
> $this->showVal = $showDataLabelValues;
return $this; }
< /** < * Get show category name. < * < * @return bool < */ < public function getShowCatName()
> public function getShowCatName(): ?bool
{ return $this->showCatName; } /** * Set show cat name * Specifies that the category name should be shown in data labels.
< * < * @param bool $value Show cat name < * < * @return $this
*/
< public function setShowCatName($value)
> public function setShowCatName(?bool $showCategoryName): self
{
< $this->showCatName = $value;
> $this->showCatName = $showCategoryName;
return $this; }
< /** < * Get show data series name. < * < * @return bool < */ < public function getShowSerName()
> public function getShowSerName(): ?bool
{ return $this->showSerName; } /**
< * Set show ser name
> * Set show data series name.
* Specifies that the series name should be shown in data labels.
< * < * @param bool $value Show series name < * < * @return $this
*/
< public function setShowSerName($value)
> public function setShowSerName(?bool $showSeriesName): self
{
< $this->showSerName = $value;
> $this->showSerName = $showSeriesName;
return $this; }
< /** < * Get show percentage. < * < * @return bool < */ < public function getShowPercent()
> public function getShowPercent(): ?bool
{ return $this->showPercent; } /**
< * Set show percentage
> * Set show percentage.
* Specifies that the percentage should be shown in data labels.
< * < * @param bool $value Show percentage < * < * @return $this
*/
< public function setShowPercent($value)
> public function setShowPercent(?bool $showPercentage): self
{
< $this->showPercent = $value;
> $this->showPercent = $showPercentage;
return $this; }
< /** < * Get show bubble size. < * < * @return bool < */ < public function getShowBubbleSize()
> public function getShowBubbleSize(): ?bool
{ return $this->showBubbleSize; } /**
< * Set show bubble size
> * Set show bubble size.
* Specifies that the bubble size should be shown in data labels.
< * < * @param bool $value Show bubble size < * < * @return $this
*/
< public function setShowBubbleSize($value)
> public function setShowBubbleSize(?bool $showBubbleSize): self
{
< $this->showBubbleSize = $value;
> $this->showBubbleSize = $showBubbleSize;
return $this; }
< /** < * Get show leader lines. < * < * @return bool < */ < public function getShowLeaderLines()
> public function getShowLeaderLines(): ?bool
{ return $this->showLeaderLines; } /**
< * Set show leader lines
> * Set show leader lines.
* Specifies that leader lines should be shown in data labels.
< * < * @param bool $value Show leader lines < * < * @return $this
*/
< public function setShowLeaderLines($value)
> public function setShowLeaderLines(?bool $showLeaderLines): self > { > $this->showLeaderLines = $showLeaderLines; > > return $this; > } > > public function getLabelFillColor(): ?ChartColor > { > return $this->labelFillColor; > } > > public function setLabelFillColor(?ChartColor $chartColor): self > { > $this->labelFillColor = $chartColor; > > return $this; > } > > public function getLabelBorderColor(): ?ChartColor > { > return $this->labelBorderColor; > } > > public function setLabelBorderColor(?ChartColor $chartColor): self > { > $this->labelBorderColor = $chartColor; > > return $this; > } > > public function getLabelFont(): ?Font > { > return $this->labelFont; > } > > public function getLabelEffects(): ?Properties > { > return $this->labelEffects; > } > > public function getLabelFontColor(): ?ChartColor > { > if ($this->labelFont === null) { > return null; > } > > return $this->labelFont->getChartColor(); > } > > public function setLabelFontColor(?ChartColor $chartColor): self > { > if ($this->labelFont === null) { > $this->labelFont = new Font(); > $this->labelFont->setSize(null, true); > } > $this->labelFont->setChartColorFromObject($chartColor); > > return $this; > } > > public function getDLblPos(): string > { > return $this->dLblPos; > } > > public function setDLblPos(string $dLblPos): self > { > $this->dLblPos = $dLblPos; > > return $this; > } > > public function getNumFmtCode(): string > { > return $this->numFmtCode; > } > > public function setNumFmtCode(string $numFmtCode): self > { > $this->numFmtCode = $numFmtCode; > > return $this; > } > > public function getNumFmtLinked(): bool > { > return $this->numFmtLinked; > } > > public function setNumFmtLinked(bool $numFmtLinked): self
{
< $this->showLeaderLines = $value;
> $this->numFmtLinked = $numFmtLinked;
return $this; } }