Properties.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: nhw2h8s
  5. * Date: 7/2/14
  6. * Time: 5:45 PM
  7. */
  8. abstract class PHPExcel_Chart_Properties
  9. {
  10. const
  11. EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
  12. EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
  13. EXCEL_COLOR_TYPE_ARGB = 'srgbClr';
  14. const
  15. AXIS_LABELS_LOW = 'low',
  16. AXIS_LABELS_HIGH = 'high',
  17. AXIS_LABELS_NEXT_TO = 'nextTo',
  18. AXIS_LABELS_NONE = 'none';
  19. const
  20. TICK_MARK_NONE = 'none',
  21. TICK_MARK_INSIDE = 'in',
  22. TICK_MARK_OUTSIDE = 'out',
  23. TICK_MARK_CROSS = 'cross';
  24. const
  25. HORIZONTAL_CROSSES_AUTOZERO = 'autoZero',
  26. HORIZONTAL_CROSSES_MAXIMUM = 'max';
  27. const
  28. FORMAT_CODE_GENERAL = 'General',
  29. FORMAT_CODE_NUMBER = '#,##0.00',
  30. FORMAT_CODE_CURRENCY = '$#,##0.00',
  31. FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
  32. FORMAT_CODE_DATE = 'm/d/yyyy',
  33. FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM',
  34. FORMAT_CODE_PERCENTAGE = '0.00%',
  35. FORMAT_CODE_FRACTION = '# ?/?',
  36. FORMAT_CODE_SCIENTIFIC = '0.00E+00',
  37. FORMAT_CODE_TEXT = '@',
  38. FORMAT_CODE_SPECIAL = '00000';
  39. const
  40. ORIENTATION_NORMAL = 'minMax',
  41. ORIENTATION_REVERSED = 'maxMin';
  42. const
  43. LINE_STYLE_COMPOUND_SIMPLE = 'sng',
  44. LINE_STYLE_COMPOUND_DOUBLE = 'dbl',
  45. LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin',
  46. LINE_STYLE_COMPOUND_THINTHICK = 'thinThick',
  47. LINE_STYLE_COMPOUND_TRIPLE = 'tri',
  48. LINE_STYLE_DASH_SOLID = 'solid',
  49. LINE_STYLE_DASH_ROUND_DOT = 'sysDot',
  50. LINE_STYLE_DASH_SQUERE_DOT = 'sysDash',
  51. LINE_STYPE_DASH_DASH = 'dash',
  52. LINE_STYLE_DASH_DASH_DOT = 'dashDot',
  53. LINE_STYLE_DASH_LONG_DASH = 'lgDash',
  54. LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot',
  55. LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot',
  56. LINE_STYLE_CAP_SQUARE = 'sq',
  57. LINE_STYLE_CAP_ROUND = 'rnd',
  58. LINE_STYLE_CAP_FLAT = 'flat',
  59. LINE_STYLE_JOIN_ROUND = 'bevel',
  60. LINE_STYLE_JOIN_MITER = 'miter',
  61. LINE_STYLE_JOIN_BEVEL = 'bevel',
  62. LINE_STYLE_ARROW_TYPE_NOARROW = null,
  63. LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
  64. LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
  65. LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
  66. LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond',
  67. LINE_STYLE_ARROW_TYPE_OVAL = 'oval',
  68. LINE_STYLE_ARROW_SIZE_1 = 1,
  69. LINE_STYLE_ARROW_SIZE_2 = 2,
  70. LINE_STYLE_ARROW_SIZE_3 = 3,
  71. LINE_STYLE_ARROW_SIZE_4 = 4,
  72. LINE_STYLE_ARROW_SIZE_5 = 5,
  73. LINE_STYLE_ARROW_SIZE_6 = 6,
  74. LINE_STYLE_ARROW_SIZE_7 = 7,
  75. LINE_STYLE_ARROW_SIZE_8 = 8,
  76. LINE_STYLE_ARROW_SIZE_9 = 9;
  77. const
  78. SHADOW_PRESETS_NOSHADOW = null,
  79. SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
  80. SHADOW_PRESETS_OUTER_BOTTOM = 2,
  81. SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
  82. SHADOW_PRESETS_OUTER_RIGHT = 4,
  83. SHADOW_PRESETS_OUTER_CENTER = 5,
  84. SHADOW_PRESETS_OUTER_LEFT = 6,
  85. SHADOW_PRESETS_OUTER_TOP_RIGHT = 7,
  86. SHADOW_PRESETS_OUTER_TOP = 8,
  87. SHADOW_PRESETS_OUTER_TOP_LEFT = 9,
  88. SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10,
  89. SHADOW_PRESETS_INNER_BOTTOM = 11,
  90. SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12,
  91. SHADOW_PRESETS_INNER_RIGHT = 13,
  92. SHADOW_PRESETS_INNER_CENTER = 14,
  93. SHADOW_PRESETS_INNER_LEFT = 15,
  94. SHADOW_PRESETS_INNER_TOP_RIGHT = 16,
  95. SHADOW_PRESETS_INNER_TOP = 17,
  96. SHADOW_PRESETS_INNER_TOP_LEFT = 18,
  97. SHADOW_PRESETS_PERSPECTIVE_BELOW = 19,
  98. SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20,
  99. SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21,
  100. SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
  101. SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
  102. protected function getExcelPointsWidth($width)
  103. {
  104. return $width * 12700;
  105. }
  106. protected function getExcelPointsAngle($angle)
  107. {
  108. return $angle * 60000;
  109. }
  110. protected function getTrueAlpha($alpha)
  111. {
  112. return (string) 100 - $alpha . '000';
  113. }
  114. protected function setColorProperties($color, $alpha, $type)
  115. {
  116. return array(
  117. 'type' => (string) $type,
  118. 'value' => (string) $color,
  119. 'alpha' => (string) $this->getTrueAlpha($alpha)
  120. );
  121. }
  122. protected function getLineStyleArrowSize($array_selector, $array_kay_selector)
  123. {
  124. $sizes = array(
  125. 1 => array('w' => 'sm', 'len' => 'sm'),
  126. 2 => array('w' => 'sm', 'len' => 'med'),
  127. 3 => array('w' => 'sm', 'len' => 'lg'),
  128. 4 => array('w' => 'med', 'len' => 'sm'),
  129. 5 => array('w' => 'med', 'len' => 'med'),
  130. 6 => array('w' => 'med', 'len' => 'lg'),
  131. 7 => array('w' => 'lg', 'len' => 'sm'),
  132. 8 => array('w' => 'lg', 'len' => 'med'),
  133. 9 => array('w' => 'lg', 'len' => 'lg')
  134. );
  135. return $sizes[$array_selector][$array_kay_selector];
  136. }
  137. protected function getShadowPresetsMap($shadow_presets_option)
  138. {
  139. $presets_options = array(
  140. //OUTER
  141. 1 => array(
  142. 'effect' => 'outerShdw',
  143. 'blur' => '50800',
  144. 'distance' => '38100',
  145. 'direction' => '2700000',
  146. 'algn' => 'tl',
  147. 'rotWithShape' => '0'
  148. ),
  149. 2 => array(
  150. 'effect' => 'outerShdw',
  151. 'blur' => '50800',
  152. 'distance' => '38100',
  153. 'direction' => '5400000',
  154. 'algn' => 't',
  155. 'rotWithShape' => '0'
  156. ),
  157. 3 => array(
  158. 'effect' => 'outerShdw',
  159. 'blur' => '50800',
  160. 'distance' => '38100',
  161. 'direction' => '8100000',
  162. 'algn' => 'tr',
  163. 'rotWithShape' => '0'
  164. ),
  165. 4 => array(
  166. 'effect' => 'outerShdw',
  167. 'blur' => '50800',
  168. 'distance' => '38100',
  169. 'algn' => 'l',
  170. 'rotWithShape' => '0'
  171. ),
  172. 5 => array(
  173. 'effect' => 'outerShdw',
  174. 'size' => array(
  175. 'sx' => '102000',
  176. 'sy' => '102000'
  177. )
  178. ,
  179. 'blur' => '63500',
  180. 'distance' => '38100',
  181. 'algn' => 'ctr',
  182. 'rotWithShape' => '0'
  183. ),
  184. 6 => array(
  185. 'effect' => 'outerShdw',
  186. 'blur' => '50800',
  187. 'distance' => '38100',
  188. 'direction' => '10800000',
  189. 'algn' => 'r',
  190. 'rotWithShape' => '0'
  191. ),
  192. 7 => array(
  193. 'effect' => 'outerShdw',
  194. 'blur' => '50800',
  195. 'distance' => '38100',
  196. 'direction' => '18900000',
  197. 'algn' => 'bl',
  198. 'rotWithShape' => '0'
  199. ),
  200. 8 => array(
  201. 'effect' => 'outerShdw',
  202. 'blur' => '50800',
  203. 'distance' => '38100',
  204. 'direction' => '16200000',
  205. 'rotWithShape' => '0'
  206. ),
  207. 9 => array(
  208. 'effect' => 'outerShdw',
  209. 'blur' => '50800',
  210. 'distance' => '38100',
  211. 'direction' => '13500000',
  212. 'algn' => 'br',
  213. 'rotWithShape' => '0'
  214. ),
  215. //INNER
  216. 10 => array(
  217. 'effect' => 'innerShdw',
  218. 'blur' => '63500',
  219. 'distance' => '50800',
  220. 'direction' => '2700000',
  221. ),
  222. 11 => array(
  223. 'effect' => 'innerShdw',
  224. 'blur' => '63500',
  225. 'distance' => '50800',
  226. 'direction' => '5400000',
  227. ),
  228. 12 => array(
  229. 'effect' => 'innerShdw',
  230. 'blur' => '63500',
  231. 'distance' => '50800',
  232. 'direction' => '8100000',
  233. ),
  234. 13 => array(
  235. 'effect' => 'innerShdw',
  236. 'blur' => '63500',
  237. 'distance' => '50800',
  238. ),
  239. 14 => array(
  240. 'effect' => 'innerShdw',
  241. 'blur' => '114300',
  242. ),
  243. 15 => array(
  244. 'effect' => 'innerShdw',
  245. 'blur' => '63500',
  246. 'distance' => '50800',
  247. 'direction' => '10800000',
  248. ),
  249. 16 => array(
  250. 'effect' => 'innerShdw',
  251. 'blur' => '63500',
  252. 'distance' => '50800',
  253. 'direction' => '18900000',
  254. ),
  255. 17 => array(
  256. 'effect' => 'innerShdw',
  257. 'blur' => '63500',
  258. 'distance' => '50800',
  259. 'direction' => '16200000',
  260. ),
  261. 18 => array(
  262. 'effect' => 'innerShdw',
  263. 'blur' => '63500',
  264. 'distance' => '50800',
  265. 'direction' => '13500000',
  266. ),
  267. //perspective
  268. 19 => array(
  269. 'effect' => 'outerShdw',
  270. 'blur' => '152400',
  271. 'distance' => '317500',
  272. 'size' => array(
  273. 'sx' => '90000',
  274. 'sy' => '-19000',
  275. ),
  276. 'direction' => '5400000',
  277. 'rotWithShape' => '0',
  278. ),
  279. 20 => array(
  280. 'effect' => 'outerShdw',
  281. 'blur' => '76200',
  282. 'direction' => '18900000',
  283. 'size' => array(
  284. 'sy' => '23000',
  285. 'kx' => '-1200000',
  286. ),
  287. 'algn' => 'bl',
  288. 'rotWithShape' => '0',
  289. ),
  290. 21 => array(
  291. 'effect' => 'outerShdw',
  292. 'blur' => '76200',
  293. 'direction' => '13500000',
  294. 'size' => array(
  295. 'sy' => '23000',
  296. 'kx' => '1200000',
  297. ),
  298. 'algn' => 'br',
  299. 'rotWithShape' => '0',
  300. ),
  301. 22 => array(
  302. 'effect' => 'outerShdw',
  303. 'blur' => '76200',
  304. 'distance' => '12700',
  305. 'direction' => '2700000',
  306. 'size' => array(
  307. 'sy' => '-23000',
  308. 'kx' => '-800400',
  309. ),
  310. 'algn' => 'bl',
  311. 'rotWithShape' => '0',
  312. ),
  313. 23 => array(
  314. 'effect' => 'outerShdw',
  315. 'blur' => '76200',
  316. 'distance' => '12700',
  317. 'direction' => '8100000',
  318. 'size' => array(
  319. 'sy' => '-23000',
  320. 'kx' => '800400',
  321. ),
  322. 'algn' => 'br',
  323. 'rotWithShape' => '0',
  324. ),
  325. );
  326. return $presets_options[$shadow_presets_option];
  327. }
  328. protected function getArrayElementsValue($properties, $elements)
  329. {
  330. $reference = & $properties;
  331. if (!is_array($elements)) {
  332. return $reference[$elements];
  333. } else {
  334. foreach ($elements as $keys) {
  335. $reference = & $reference[$keys];
  336. }
  337. return $reference;
  338. }
  339. return $this;
  340. }
  341. }