[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Created by PhpStorm. 5 * User: Wiktor Trzonkowski 6 * Date: 6/17/14 7 * Time: 12:11 PM 8 */ 9 10 class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties 11 { 12 /** 13 * Axis Number 14 * 15 * @var array of mixed 16 */ 17 private $axisNumber = array( 18 'format' => self::FORMAT_CODE_GENERAL, 19 'source_linked' => 1 20 ); 21 22 /** 23 * Axis Options 24 * 25 * @var array of mixed 26 */ 27 private $axisOptions = array( 28 'minimum' => null, 29 'maximum' => null, 30 'major_unit' => null, 31 'minor_unit' => null, 32 'orientation' => self::ORIENTATION_NORMAL, 33 'minor_tick_mark' => self::TICK_MARK_NONE, 34 'major_tick_mark' => self::TICK_MARK_NONE, 35 'axis_labels' => self::AXIS_LABELS_NEXT_TO, 36 'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO, 37 'horizontal_crosses_value' => null 38 ); 39 40 /** 41 * Fill Properties 42 * 43 * @var array of mixed 44 */ 45 private $fillProperties = array( 46 'type' => self::EXCEL_COLOR_TYPE_ARGB, 47 'value' => null, 48 'alpha' => 0 49 ); 50 51 /** 52 * Line Properties 53 * 54 * @var array of mixed 55 */ 56 private $lineProperties = array( 57 'type' => self::EXCEL_COLOR_TYPE_ARGB, 58 'value' => null, 59 'alpha' => 0 60 ); 61 62 /** 63 * Line Style Properties 64 * 65 * @var array of mixed 66 */ 67 private $lineStyleProperties = array( 68 'width' => '9525', 69 'compound' => self::LINE_STYLE_COMPOUND_SIMPLE, 70 'dash' => self::LINE_STYLE_DASH_SOLID, 71 'cap' => self::LINE_STYLE_CAP_FLAT, 72 'join' => self::LINE_STYLE_JOIN_BEVEL, 73 'arrow' => array( 74 'head' => array( 75 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW, 76 'size' => self::LINE_STYLE_ARROW_SIZE_5 77 ), 78 'end' => array( 79 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW, 80 'size' => self::LINE_STYLE_ARROW_SIZE_8 81 ), 82 ) 83 ); 84 85 /** 86 * Shadow Properties 87 * 88 * @var array of mixed 89 */ 90 private $shadowProperties = array( 91 'presets' => self::SHADOW_PRESETS_NOSHADOW, 92 'effect' => null, 93 'color' => array( 94 'type' => self::EXCEL_COLOR_TYPE_STANDARD, 95 'value' => 'black', 96 'alpha' => 40, 97 ), 98 'size' => array( 99 'sx' => null, 100 'sy' => null, 101 'kx' => null 102 ), 103 'blur' => null, 104 'direction' => null, 105 'distance' => null, 106 'algn' => null, 107 'rotWithShape' => null 108 ); 109 110 /** 111 * Glow Properties 112 * 113 * @var array of mixed 114 */ 115 private $glowProperties = array( 116 'size' => null, 117 'color' => array( 118 'type' => self::EXCEL_COLOR_TYPE_STANDARD, 119 'value' => 'black', 120 'alpha' => 40 121 ) 122 ); 123 124 /** 125 * Soft Edge Properties 126 * 127 * @var array of mixed 128 */ 129 private $softEdges = array( 130 'size' => null 131 ); 132 133 /** 134 * Get Series Data Type 135 * 136 * @return string 137 */ 138 public function setAxisNumberProperties($format_code) 139 { 140 $this->axisNumber['format'] = (string) $format_code; 141 $this->axisNumber['source_linked'] = 0; 142 } 143 144 /** 145 * Get Axis Number Format Data Type 146 * 147 * @return string 148 */ 149 public function getAxisNumberFormat() 150 { 151 return $this->axisNumber['format']; 152 } 153 154 /** 155 * Get Axis Number Source Linked 156 * 157 * @return string 158 */ 159 public function getAxisNumberSourceLinked() 160 { 161 return (string) $this->axisNumber['source_linked']; 162 } 163 164 /** 165 * Set Axis Options Properties 166 * 167 * @param string $axis_labels 168 * @param string $horizontal_crosses_value 169 * @param string $horizontal_crosses 170 * @param string $axis_orientation 171 * @param string $major_tmt 172 * @param string $minor_tmt 173 * @param string $minimum 174 * @param string $maximum 175 * @param string $major_unit 176 * @param string $minor_unit 177 * 178 */ 179 public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null) 180 { 181 $this->axisOptions['axis_labels'] = (string) $axis_labels; 182 ($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null; 183 ($horizontal_crosses !== null) ? $this->axisOptions['horizontal_crosses'] = (string) $horizontal_crosses : null; 184 ($axis_orientation !== null) ? $this->axisOptions['orientation'] = (string) $axis_orientation : null; 185 ($major_tmt !== null) ? $this->axisOptions['major_tick_mark'] = (string) $major_tmt : null; 186 ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null; 187 ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null; 188 ($minimum !== null) ? $this->axisOptions['minimum'] = (string) $minimum : null; 189 ($maximum !== null) ? $this->axisOptions['maximum'] = (string) $maximum : null; 190 ($major_unit !== null) ? $this->axisOptions['major_unit'] = (string) $major_unit : null; 191 ($minor_unit !== null) ? $this->axisOptions['minor_unit'] = (string) $minor_unit : null; 192 } 193 194 /** 195 * Get Axis Options Property 196 * 197 * @param string $property 198 * 199 * @return string 200 */ 201 public function getAxisOptionsProperty($property) 202 { 203 return $this->axisOptions[$property]; 204 } 205 206 /** 207 * Set Axis Orientation Property 208 * 209 * @param string $orientation 210 * 211 */ 212 public function setAxisOrientation($orientation) 213 { 214 $this->orientation = (string) $orientation; 215 } 216 217 /** 218 * Set Fill Property 219 * 220 * @param string $color 221 * @param int $alpha 222 * @param string $type 223 * 224 */ 225 public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) 226 { 227 $this->fillProperties = $this->setColorProperties($color, $alpha, $type); 228 } 229 230 /** 231 * Set Line Property 232 * 233 * @param string $color 234 * @param int $alpha 235 * @param string $type 236 * 237 */ 238 public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) 239 { 240 $this->lineProperties = $this->setColorProperties($color, $alpha, $type); 241 } 242 243 /** 244 * Get Fill Property 245 * 246 * @param string $property 247 * 248 * @return string 249 */ 250 public function getFillProperty($property) 251 { 252 return $this->fillProperties[$property]; 253 } 254 255 /** 256 * Get Line Property 257 * 258 * @param string $property 259 * 260 * @return string 261 */ 262 public function getLineProperty($property) 263 { 264 return $this->lineProperties[$property]; 265 } 266 267 /** 268 * Set Line Style Properties 269 * 270 * @param float $line_width 271 * @param string $compound_type 272 * @param string $dash_type 273 * @param string $cap_type 274 * @param string $join_type 275 * @param string $head_arrow_type 276 * @param string $head_arrow_size 277 * @param string $end_arrow_type 278 * @param string $end_arrow_size 279 * 280 */ 281 public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) 282 { 283 (!is_null($line_width)) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null; 284 (!is_null($compound_type)) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null; 285 (!is_null($dash_type)) ? $this->lineStyleProperties['dash'] = (string) $dash_type : null; 286 (!is_null($cap_type)) ? $this->lineStyleProperties['cap'] = (string) $cap_type : null; 287 (!is_null($join_type)) ? $this->lineStyleProperties['join'] = (string) $join_type : null; 288 (!is_null($head_arrow_type)) ? $this->lineStyleProperties['arrow']['head']['type'] = (string) $head_arrow_type : null; 289 (!is_null($head_arrow_size)) ? $this->lineStyleProperties['arrow']['head']['size'] = (string) $head_arrow_size : null; 290 (!is_null($end_arrow_type)) ? $this->lineStyleProperties['arrow']['end']['type'] = (string) $end_arrow_type : null; 291 (!is_null($end_arrow_size)) ? $this->lineStyleProperties['arrow']['end']['size'] = (string) $end_arrow_size : null; 292 } 293 294 /** 295 * Get Line Style Property 296 * 297 * @param array|string $elements 298 * 299 * @return string 300 */ 301 public function getLineStyleProperty($elements) 302 { 303 return $this->getArrayElementsValue($this->lineStyleProperties, $elements); 304 } 305 306 /** 307 * Get Line Style Arrow Excel Width 308 * 309 * @param string $arrow 310 * 311 * @return string 312 */ 313 public function getLineStyleArrowWidth($arrow) 314 { 315 return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w'); 316 } 317 318 /** 319 * Get Line Style Arrow Excel Length 320 * 321 * @param string $arrow 322 * 323 * @return string 324 */ 325 public function getLineStyleArrowLength($arrow) 326 { 327 return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len'); 328 } 329 330 /** 331 * Set Shadow Properties 332 * 333 * @param int $shadow_presets 334 * @param string $sh_color_value 335 * @param string $sh_color_type 336 * @param string $sh_color_alpha 337 * @param float $sh_blur 338 * @param int $sh_angle 339 * @param float $sh_distance 340 * 341 */ 342 public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) 343 { 344 $this->setShadowPresetsProperties((int) $sh_presets) 345 ->setShadowColor( 346 is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value, 347 is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $sh_color_alpha, 348 is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type 349 ) 350 ->setShadowBlur($sh_blur) 351 ->setShadowAngle($sh_angle) 352 ->setShadowDistance($sh_distance); 353 } 354 355 /** 356 * Set Shadow Color 357 * 358 * @param int $shadow_presets 359 * 360 * @return PHPExcel_Chart_Axis 361 */ 362 private function setShadowPresetsProperties($shadow_presets) 363 { 364 $this->shadowProperties['presets'] = $shadow_presets; 365 $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets)); 366 367 return $this; 368 } 369 370 /** 371 * Set Shadow Properties from Maped Values 372 * 373 * @param array $properties_map 374 * @param * $reference 375 * 376 * @return PHPExcel_Chart_Axis 377 */ 378 private function setShadowProperiesMapValues(array $properties_map, &$reference = null) 379 { 380 $base_reference = $reference; 381 foreach ($properties_map as $property_key => $property_val) { 382 if (is_array($property_val)) { 383 if ($reference === null) { 384 $reference = & $this->shadowProperties[$property_key]; 385 } else { 386 $reference = & $reference[$property_key]; 387 } 388 $this->setShadowProperiesMapValues($property_val, $reference); 389 } else { 390 if ($base_reference === null) { 391 $this->shadowProperties[$property_key] = $property_val; 392 } else { 393 $reference[$property_key] = $property_val; 394 } 395 } 396 } 397 398 return $this; 399 } 400 401 /** 402 * Set Shadow Color 403 * 404 * @param string $color 405 * @param int $alpha 406 * @param string $type 407 * 408 * @return PHPExcel_Chart_Axis 409 */ 410 private function setShadowColor($color, $alpha, $type) 411 { 412 $this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type); 413 414 return $this; 415 } 416 417 /** 418 * Set Shadow Blur 419 * 420 * @param float $blur 421 * 422 * @return PHPExcel_Chart_Axis 423 */ 424 private function setShadowBlur($blur) 425 { 426 if ($blur !== null) { 427 $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur); 428 } 429 430 return $this; 431 } 432 433 /** 434 * Set Shadow Angle 435 * 436 * @param int $angle 437 * 438 * @return PHPExcel_Chart_Axis 439 */ 440 private function setShadowAngle($angle) 441 { 442 if ($angle !== null) { 443 $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle); 444 } 445 446 return $this; 447 } 448 449 /** 450 * Set Shadow Distance 451 * 452 * @param float $distance 453 * 454 * @return PHPExcel_Chart_Axis 455 */ 456 private function setShadowDistance($distance) 457 { 458 if ($distance !== null) { 459 $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance); 460 } 461 462 return $this; 463 } 464 465 /** 466 * Get Glow Property 467 * 468 * @param float $size 469 * @param string $color_value 470 * @param int $color_alpha 471 * @param string $color_type 472 */ 473 public function getShadowProperty($elements) 474 { 475 return $this->getArrayElementsValue($this->shadowProperties, $elements); 476 } 477 478 /** 479 * Set Glow Properties 480 * 481 * @param float $size 482 * @param string $color_value 483 * @param int $color_alpha 484 * @param string $color_type 485 */ 486 public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) 487 { 488 $this->setGlowSize($size) 489 ->setGlowColor( 490 is_null($color_value) ? $this->glowProperties['color']['value'] : $color_value, 491 is_null($color_alpha) ? (int) $this->glowProperties['color']['alpha'] : $color_alpha, 492 is_null($color_type) ? $this->glowProperties['color']['type'] : $color_type 493 ); 494 } 495 496 /** 497 * Get Glow Property 498 * 499 * @param array|string $property 500 * 501 * @return string 502 */ 503 public function getGlowProperty($property) 504 { 505 return $this->getArrayElementsValue($this->glowProperties, $property); 506 } 507 508 /** 509 * Set Glow Color 510 * 511 * @param float $size 512 * 513 * @return PHPExcel_Chart_Axis 514 */ 515 private function setGlowSize($size) 516 { 517 if (!is_null($size)) { 518 $this->glowProperties['size'] = $this->getExcelPointsWidth($size); 519 } 520 521 return $this; 522 } 523 524 /** 525 * Set Glow Color 526 * 527 * @param string $color 528 * @param int $alpha 529 * @param string $type 530 * 531 * @return PHPExcel_Chart_Axis 532 */ 533 private function setGlowColor($color, $alpha, $type) 534 { 535 $this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type); 536 537 return $this; 538 } 539 540 /** 541 * Set Soft Edges Size 542 * 543 * @param float $size 544 */ 545 public function setSoftEdges($size) 546 { 547 if (!is_null($size)) { 548 $softEdges['size'] = (string) $this->getExcelPointsWidth($size); 549 } 550 } 551 552 /** 553 * Get Soft Edges Size 554 * 555 * @return string 556 */ 557 public function getSoftEdgesSize() 558 { 559 return $this->softEdges['size']; 560 } 561 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |