Layout.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheet\Chart;
  3. class Layout
  4. {
  5. /**
  6. * layoutTarget.
  7. *
  8. * @var string
  9. */
  10. private $layoutTarget;
  11. /**
  12. * X Mode.
  13. *
  14. * @var string
  15. */
  16. private $xMode;
  17. /**
  18. * Y Mode.
  19. *
  20. * @var string
  21. */
  22. private $yMode;
  23. /**
  24. * X-Position.
  25. *
  26. * @var float
  27. */
  28. private $xPos;
  29. /**
  30. * Y-Position.
  31. *
  32. * @var float
  33. */
  34. private $yPos;
  35. /**
  36. * width.
  37. *
  38. * @var float
  39. */
  40. private $width;
  41. /**
  42. * height.
  43. *
  44. * @var float
  45. */
  46. private $height;
  47. /**
  48. * show legend key
  49. * Specifies that legend keys should be shown in data labels.
  50. *
  51. * @var bool
  52. */
  53. private $showLegendKey;
  54. /**
  55. * show value
  56. * Specifies that the value should be shown in a data label.
  57. *
  58. * @var bool
  59. */
  60. private $showVal;
  61. /**
  62. * show category name
  63. * Specifies that the category name should be shown in the data label.
  64. *
  65. * @var bool
  66. */
  67. private $showCatName;
  68. /**
  69. * show data series name
  70. * Specifies that the series name should be shown in the data label.
  71. *
  72. * @var bool
  73. */
  74. private $showSerName;
  75. /**
  76. * show percentage
  77. * Specifies that the percentage should be shown in the data label.
  78. *
  79. * @var bool
  80. */
  81. private $showPercent;
  82. /**
  83. * show bubble size.
  84. *
  85. * @var bool
  86. */
  87. private $showBubbleSize;
  88. /**
  89. * show leader lines
  90. * Specifies that leader lines should be shown for the data label.
  91. *
  92. * @var bool
  93. */
  94. private $showLeaderLines;
  95. /**
  96. * Create a new Layout.
  97. */
  98. public function __construct(array $layout = [])
  99. {
  100. if (isset($layout['layoutTarget'])) {
  101. $this->layoutTarget = $layout['layoutTarget'];
  102. }
  103. if (isset($layout['xMode'])) {
  104. $this->xMode = $layout['xMode'];
  105. }
  106. if (isset($layout['yMode'])) {
  107. $this->yMode = $layout['yMode'];
  108. }
  109. if (isset($layout['x'])) {
  110. $this->xPos = (float) $layout['x'];
  111. }
  112. if (isset($layout['y'])) {
  113. $this->yPos = (float) $layout['y'];
  114. }
  115. if (isset($layout['w'])) {
  116. $this->width = (float) $layout['w'];
  117. }
  118. if (isset($layout['h'])) {
  119. $this->height = (float) $layout['h'];
  120. }
  121. }
  122. /**
  123. * Get Layout Target.
  124. *
  125. * @return string
  126. */
  127. public function getLayoutTarget()
  128. {
  129. return $this->layoutTarget;
  130. }
  131. /**
  132. * Set Layout Target.
  133. *
  134. * @param string $value
  135. *
  136. * @return $this
  137. */
  138. public function setLayoutTarget($value)
  139. {
  140. $this->layoutTarget = $value;
  141. return $this;
  142. }
  143. /**
  144. * Get X-Mode.
  145. *
  146. * @return string
  147. */
  148. public function getXMode()
  149. {
  150. return $this->xMode;
  151. }
  152. /**
  153. * Set X-Mode.
  154. *
  155. * @param string $value
  156. *
  157. * @return $this
  158. */
  159. public function setXMode($value)
  160. {
  161. $this->xMode = (string) $value;
  162. return $this;
  163. }
  164. /**
  165. * Get Y-Mode.
  166. *
  167. * @return string
  168. */
  169. public function getYMode()
  170. {
  171. return $this->yMode;
  172. }
  173. /**
  174. * Set Y-Mode.
  175. *
  176. * @param string $value
  177. *
  178. * @return $this
  179. */
  180. public function setYMode($value)
  181. {
  182. $this->yMode = (string) $value;
  183. return $this;
  184. }
  185. /**
  186. * Get X-Position.
  187. *
  188. * @return number
  189. */
  190. public function getXPosition()
  191. {
  192. return $this->xPos;
  193. }
  194. /**
  195. * Set X-Position.
  196. *
  197. * @param float $value
  198. *
  199. * @return $this
  200. */
  201. public function setXPosition($value)
  202. {
  203. $this->xPos = (float) $value;
  204. return $this;
  205. }
  206. /**
  207. * Get Y-Position.
  208. *
  209. * @return number
  210. */
  211. public function getYPosition()
  212. {
  213. return $this->yPos;
  214. }
  215. /**
  216. * Set Y-Position.
  217. *
  218. * @param float $value
  219. *
  220. * @return $this
  221. */
  222. public function setYPosition($value)
  223. {
  224. $this->yPos = (float) $value;
  225. return $this;
  226. }
  227. /**
  228. * Get Width.
  229. *
  230. * @return number
  231. */
  232. public function getWidth()
  233. {
  234. return $this->width;
  235. }
  236. /**
  237. * Set Width.
  238. *
  239. * @param float $value
  240. *
  241. * @return $this
  242. */
  243. public function setWidth($value)
  244. {
  245. $this->width = $value;
  246. return $this;
  247. }
  248. /**
  249. * Get Height.
  250. *
  251. * @return number
  252. */
  253. public function getHeight()
  254. {
  255. return $this->height;
  256. }
  257. /**
  258. * Set Height.
  259. *
  260. * @param float $value
  261. *
  262. * @return $this
  263. */
  264. public function setHeight($value)
  265. {
  266. $this->height = $value;
  267. return $this;
  268. }
  269. /**
  270. * Get show legend key.
  271. *
  272. * @return bool
  273. */
  274. public function getShowLegendKey()
  275. {
  276. return $this->showLegendKey;
  277. }
  278. /**
  279. * Set show legend key
  280. * Specifies that legend keys should be shown in data labels.
  281. *
  282. * @param bool $value Show legend key
  283. *
  284. * @return $this
  285. */
  286. public function setShowLegendKey($value)
  287. {
  288. $this->showLegendKey = $value;
  289. return $this;
  290. }
  291. /**
  292. * Get show value.
  293. *
  294. * @return bool
  295. */
  296. public function getShowVal()
  297. {
  298. return $this->showVal;
  299. }
  300. /**
  301. * Set show val
  302. * Specifies that the value should be shown in data labels.
  303. *
  304. * @param bool $value Show val
  305. *
  306. * @return $this
  307. */
  308. public function setShowVal($value)
  309. {
  310. $this->showVal = $value;
  311. return $this;
  312. }
  313. /**
  314. * Get show category name.
  315. *
  316. * @return bool
  317. */
  318. public function getShowCatName()
  319. {
  320. return $this->showCatName;
  321. }
  322. /**
  323. * Set show cat name
  324. * Specifies that the category name should be shown in data labels.
  325. *
  326. * @param bool $value Show cat name
  327. *
  328. * @return $this
  329. */
  330. public function setShowCatName($value)
  331. {
  332. $this->showCatName = $value;
  333. return $this;
  334. }
  335. /**
  336. * Get show data series name.
  337. *
  338. * @return bool
  339. */
  340. public function getShowSerName()
  341. {
  342. return $this->showSerName;
  343. }
  344. /**
  345. * Set show ser name
  346. * Specifies that the series name should be shown in data labels.
  347. *
  348. * @param bool $value Show series name
  349. *
  350. * @return $this
  351. */
  352. public function setShowSerName($value)
  353. {
  354. $this->showSerName = $value;
  355. return $this;
  356. }
  357. /**
  358. * Get show percentage.
  359. *
  360. * @return bool
  361. */
  362. public function getShowPercent()
  363. {
  364. return $this->showPercent;
  365. }
  366. /**
  367. * Set show percentage
  368. * Specifies that the percentage should be shown in data labels.
  369. *
  370. * @param bool $value Show percentage
  371. *
  372. * @return $this
  373. */
  374. public function setShowPercent($value)
  375. {
  376. $this->showPercent = $value;
  377. return $this;
  378. }
  379. /**
  380. * Get show bubble size.
  381. *
  382. * @return bool
  383. */
  384. public function getShowBubbleSize()
  385. {
  386. return $this->showBubbleSize;
  387. }
  388. /**
  389. * Set show bubble size
  390. * Specifies that the bubble size should be shown in data labels.
  391. *
  392. * @param bool $value Show bubble size
  393. *
  394. * @return $this
  395. */
  396. public function setShowBubbleSize($value)
  397. {
  398. $this->showBubbleSize = $value;
  399. return $this;
  400. }
  401. /**
  402. * Get show leader lines.
  403. *
  404. * @return bool
  405. */
  406. public function getShowLeaderLines()
  407. {
  408. return $this->showLeaderLines;
  409. }
  410. /**
  411. * Set show leader lines
  412. * Specifies that leader lines should be shown in data labels.
  413. *
  414. * @param bool $value Show leader lines
  415. *
  416. * @return $this
  417. */
  418. public function setShowLeaderLines($value)
  419. {
  420. $this->showLeaderLines = $value;
  421. return $this;
  422. }
  423. }