00001 <?php 00002 /*************************************************************************** 00003 * Copyright (C) 2009 by Denis M. Gabaidulin * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU Lesser General Public License as * 00007 * published by the Free Software Foundation; either version 3 of the * 00008 * License, or (at your option) any later version. * 00009 * * 00010 ***************************************************************************/ 00011 00012 // TODO: support other params 00013 00017 final class GoogleChartLabelStyleNumberType 00018 extends BaseGoogleChartLabelStyleType 00019 { 00020 protected $name = 'N'; 00021 00022 private $precisionLevel = null; 00023 private $type = null; 00024 private $withTrailingZero = false; 00025 00026 00030 public static function create() 00031 { 00032 return new self; 00033 } 00034 00035 public function __construct() 00036 { 00037 $this->precisionLevel = 0; 00038 } 00039 00043 public function setPrecisionLevel($level) 00044 { 00045 $this->precisionLevel = $level; 00046 00047 return $this; 00048 } 00049 00050 public function getPrecisionLevel() 00051 { 00052 return $this->precisionLevel; 00053 } 00054 00058 public function setType(LabelStyleType $type) 00059 { 00060 $this->type = $type; 00061 00062 return $this; 00063 } 00064 00068 public function getType() 00069 { 00070 return $this->type; 00071 } 00072 00076 public function setWithTrailingZero($orly = true) 00077 { 00078 $this->withTrailingZero = (true === $orly); 00079 00080 return $this; 00081 } 00082 00083 public function withTrailingZero() 00084 { 00085 return $this->withTrailingZero; 00086 } 00087 00088 public function toString() 00089 { 00090 return 00091 $this->name 00092 .'*' 00093 .( 00094 $this->type 00095 ? $this->type->toString() 00096 : null 00097 00098 ) 00099 .( 00100 $this->withTrailingZero 00101 ? 'z' 00102 : null 00103 00104 ) 00105 .'*'; 00106 } 00107 } 00108 ?>