Layout.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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. * @param array $layout
  99. */
  100. public function __construct(array $layout = [])
  101. {
  102. if (isset($layout['layoutTarget'])) {
  103. $this->layoutTarget = $layout['layoutTarget'];
  104. }
  105. if (isset($layout['xMode'])) {
  106. $this->xMode = $layout['xMode'];
  107. }
  108. if (isset($layout['yMode'])) {
  109. $this->yMode = $layout['yMode'];
  110. }
  111. if (isset($layout['x'])) {
  112. $this->xPos = (float) $layout['x'];
  113. }
  114. if (isset($layout['y'])) {
  115. $this->yPos = (float) $layout['y'];
  116. }
  117. if (isset($layout['w'])) {
  118. $this->width = (float) $layout['w'];
  119. }
  120. if (isset($layout['h'])) {
  121. $this->height = (float) $layout['h'];
  122. }
  123. }
  124. /**
  125. * Get Layout Target.
  126. *
  127. * @return string
  128. */
  129. public function getLayoutTarget()
  130. {
  131. return $this->layoutTarget;
  132. }
  133. /**
  134. * Set Layout Target.
  135. *
  136. * @param string $value
  137. *
  138. * @return Layout
  139. */
  140. public function setLayoutTarget($value)
  141. {
  142. $this->layoutTarget = $value;
  143. return $this;
  144. }
  145. /**
  146. * Get X-Mode.
  147. *
  148. * @return string
  149. */
  150. public function getXMode()
  151. {
  152. return $this->xMode;
  153. }
  154. /**
  155. * Set X-Mode.
  156. *
  157. * @param X-Mode $value
  158. *
  159. * @return Layout
  160. */
  161. public function setXMode($value)
  162. {
  163. $this->xMode = $value;
  164. return $this;
  165. }
  166. /**
  167. * Get Y-Mode.
  168. *
  169. * @return string
  170. */
  171. public function getYMode()
  172. {
  173. return $this->yMode;
  174. }
  175. /**
  176. * Set Y-Mode.
  177. *
  178. * @param Y-Mode $value
  179. *
  180. * @return Layout
  181. */
  182. public function setYMode($value)
  183. {
  184. $this->yMode = $value;
  185. return $this;
  186. }
  187. /**
  188. * Get X-Position.
  189. *
  190. * @return number
  191. */
  192. public function getXPosition()
  193. {
  194. return $this->xPos;
  195. }
  196. /**
  197. * Set X-Position.
  198. *
  199. * @param X-Position $value
  200. *
  201. * @return Layout
  202. */
  203. public function setXPosition($value)
  204. {
  205. $this->xPos = $value;
  206. return $this;
  207. }
  208. /**
  209. * Get Y-Position.
  210. *
  211. * @return number
  212. */
  213. public function getYPosition()
  214. {
  215. return $this->yPos;
  216. }
  217. /**
  218. * Set Y-Position.
  219. *
  220. * @param Y-Position $value
  221. *
  222. * @return Layout
  223. */
  224. public function setYPosition($value)
  225. {
  226. $this->yPos = $value;
  227. return $this;
  228. }
  229. /**
  230. * Get Width.
  231. *
  232. * @return number
  233. */
  234. public function getWidth()
  235. {
  236. return $this->width;
  237. }
  238. /**
  239. * Set Width.
  240. *
  241. * @param float $value
  242. *
  243. * @return Layout
  244. */
  245. public function setWidth($value)
  246. {
  247. $this->width = $value;
  248. return $this;
  249. }
  250. /**
  251. * Get Height.
  252. *
  253. * @return number
  254. */
  255. public function getHeight()
  256. {
  257. return $this->height;
  258. }
  259. /**
  260. * Set Height.
  261. *
  262. * @param float $value
  263. *
  264. * @return Layout
  265. */
  266. public function setHeight($value)
  267. {
  268. $this->height = $value;
  269. return $this;
  270. }
  271. /**
  272. * Get show legend key.
  273. *
  274. * @return bool
  275. */
  276. public function getShowLegendKey()
  277. {
  278. return $this->showLegendKey;
  279. }
  280. /**
  281. * Set show legend key
  282. * Specifies that legend keys should be shown in data labels.
  283. *
  284. * @param bool $value Show legend key
  285. *
  286. * @return Layout
  287. */
  288. public function setShowLegendKey($value)
  289. {
  290. $this->showLegendKey = $value;
  291. return $this;
  292. }
  293. /**
  294. * Get show value.
  295. *
  296. * @return bool
  297. */
  298. public function getShowVal()
  299. {
  300. return $this->showVal;
  301. }
  302. /**
  303. * Set show val
  304. * Specifies that the value should be shown in data labels.
  305. *
  306. * @param bool $value Show val
  307. *
  308. * @return Layout
  309. */
  310. public function setShowVal($value)
  311. {
  312. $this->showVal = $value;
  313. return $this;
  314. }
  315. /**
  316. * Get show category name.
  317. *
  318. * @return bool
  319. */
  320. public function getShowCatName()
  321. {
  322. return $this->showCatName;
  323. }
  324. /**
  325. * Set show cat name
  326. * Specifies that the category name should be shown in data labels.
  327. *
  328. * @param bool $value Show cat name
  329. *
  330. * @return Layout
  331. */
  332. public function setShowCatName($value)
  333. {
  334. $this->showCatName = $value;
  335. return $this;
  336. }
  337. /**
  338. * Get show data series name.
  339. *
  340. * @return bool
  341. */
  342. public function getShowSerName()
  343. {
  344. return $this->showSerName;
  345. }
  346. /**
  347. * Set show ser name
  348. * Specifies that the series name should be shown in data labels.
  349. *
  350. * @param bool $value Show series name
  351. *
  352. * @return Layout
  353. */
  354. public function setShowSerName($value)
  355. {
  356. $this->showSerName = $value;
  357. return $this;
  358. }
  359. /**
  360. * Get show percentage.
  361. *
  362. * @return bool
  363. */
  364. public function getShowPercent()
  365. {
  366. return $this->showPercent;
  367. }
  368. /**
  369. * Set show percentage
  370. * Specifies that the percentage should be shown in data labels.
  371. *
  372. * @param bool $value Show percentage
  373. *
  374. * @return Layout
  375. */
  376. public function setShowPercent($value)
  377. {
  378. $this->showPercent = $value;
  379. return $this;
  380. }
  381. /**
  382. * Get show bubble size.
  383. *
  384. * @return bool
  385. */
  386. public function getShowBubbleSize()
  387. {
  388. return $this->showBubbleSize;
  389. }
  390. /**
  391. * Set show bubble size
  392. * Specifies that the bubble size should be shown in data labels.
  393. *
  394. * @param bool $value Show bubble size
  395. *
  396. * @return Layout
  397. */
  398. public function setShowBubbleSize($value)
  399. {
  400. $this->showBubbleSize = $value;
  401. return $this;
  402. }
  403. /**
  404. * Get show leader lines.
  405. *
  406. * @return bool
  407. */
  408. public function getShowLeaderLines()
  409. {
  410. return $this->showLeaderLines;
  411. }
  412. /**
  413. * Set show leader lines
  414. * Specifies that leader lines should be shown in data labels.
  415. *
  416. * @param bool $value Show leader lines
  417. *
  418. * @return Layout
  419. */
  420. public function setShowLeaderLines($value)
  421. {
  422. $this->showLeaderLines = $value;
  423. return $this;
  424. }
  425. }