Beispiel #1
0
 /**
  * Set an option value
  * 
  * @param string $propertyName 
  * @param mixed $propertyValue 
  * @throws ezcBasePropertyNotFoundException
  *          If a property is not defined in this class
  * @return void
  * @ignore
  */
 public function __set($propertyName, $propertyValue)
 {
     switch ($propertyName) {
         case 'label':
             $this->properties['label'] = (string) $propertyValue;
             break;
         case 'labelCallback':
             if (is_callable($propertyValue)) {
                 $this->properties['labelCallback'] = $propertyValue;
             } else {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'callback function');
             }
             break;
         case 'sum':
             if (!is_numeric($propertyValue) || $propertyValue <= 0) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'float > 0');
             }
             $this->properties['sum'] = (double) $propertyValue;
             break;
         case 'percentThreshold':
             if (!is_numeric($propertyValue) || $propertyValue < 0 || $propertyValue > 1) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, '0 <= float <= 1');
             }
             $this->properties['percentThreshold'] = (double) $propertyValue;
             break;
         case 'absoluteThreshold':
             if (!is_numeric($propertyValue) || $propertyValue <= 0) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'float > 0');
             }
             $this->properties['absoluteThreshold'] = (double) $propertyValue;
             break;
         case 'summarizeCaption':
             $this->properties['summarizeCaption'] = (string) $propertyValue;
             break;
         default:
             return parent::__set($propertyName, $propertyValue);
     }
 }
 /**
  * __get 
  * 
  * @param mixed $propertyName 
  * @throws ezcBasePropertyNotFoundException
  *          If a the value for the property options is not an instance of
  * @return mixed
  * @ignore
  */
 public function __get($propertyName)
 {
     switch ($propertyName) {
         case 'highlightFont':
             // Clone font configuration when requested for this element
             if (!$this->properties['highlightFontCloned']) {
                 $this->properties['highlightFont'] = clone $this->properties['font'];
                 $this->properties['highlightFontCloned'] = true;
             }
             return $this->properties['highlightFont'];
         default:
             return parent::__get($propertyName);
     }
 }
 /**
  * Set an option value
  *
  * @param string $propertyName
  * @param mixed $propertyValue
  * @throws ezcBasePropertyNotFoundException
  *          If a property is not defined in this class
  * @return void
  * @ignore
  */
 public function __set($propertyName, $propertyValue)
 {
     switch ($propertyName) {
         case 'borderWidth':
         case 'markerWidth':
             if (!is_numeric($propertyValue) || $propertyValue < 1) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'int >= 1');
             }
             $this->properties[$propertyName] = (int) $propertyValue;
             break;
         case 'borderColor':
         case 'startColor':
         case 'endColor':
             $this->properties[$propertyName] = ezcGraphColor::create($propertyValue);
             break;
         case 'odometerHeight':
             if (!is_numeric($propertyValue) || $propertyValue < 0 || $propertyValue > 1) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, '0 <= float <= 1');
             }
             $this->properties[$propertyName] = (double) $propertyValue;
             break;
         default:
             return parent::__set($propertyName, $propertyValue);
     }
 }
Beispiel #4
0
 /**
  * Set an option value
  * 
  * @param string $propertyName 
  * @param mixed $propertyValue 
  * @throws ezcBasePropertyNotFoundException
  *          If a property is not defined in this class
  * @return void
  * @ignore
  */
 public function __set($propertyName, $propertyValue)
 {
     switch ($propertyName) {
         case 'dataBorder':
         case 'pieChartGleam':
         case 'legendSymbolGleam':
             if ($propertyValue !== false && !is_numeric($propertyValue) || $propertyValue < 0 || $propertyValue > 1) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'false OR 0 <= float <= 1');
             }
             $this->properties[$propertyName] = $propertyValue === false ? false : (double) $propertyValue;
             break;
         case 'maxLabelHeight':
         case 'moveOut':
         case 'barMargin':
         case 'barPadding':
         case 'legendSymbolGleamSize':
         case 'pieVerticalSize':
         case 'pieHorizontalSize':
             if (!is_numeric($propertyValue) || $propertyValue < 0 || $propertyValue > 1) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, '0 <= float <= 1');
             }
             $this->properties[$propertyName] = (double) $propertyValue;
             break;
         case 'symbolSize':
         case 'titlePosition':
         case 'titleAlignement':
         case 'pieChartGleamBorder':
             if (!is_numeric($propertyValue) || $propertyValue < 0) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'int >= 0');
             }
             $this->properties[$propertyName] = (int) $propertyValue;
             break;
         case 'showSymbol':
         case 'syncAxisFonts':
             if (!is_bool($propertyValue)) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'bool');
             }
             $this->properties[$propertyName] = (bool) $propertyValue;
             break;
         case 'pieChartOffset':
             if (!is_numeric($propertyValue) || $propertyValue < 0 || $propertyValue > 360) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, '0 <= float <= 360');
             }
             $this->properties[$propertyName] = (double) $propertyValue;
             break;
         case 'pieChartSymbolColor':
         case 'pieChartGleamColor':
         case 'legendSymbolGleamColor':
             $this->properties[$propertyName] = ezcGraphColor::create($propertyValue);
             break;
         default:
             return parent::__set($propertyName, $propertyValue);
     }
 }