Exemple #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);
     }
 }
 /**
  * Set an option value
  * 
  * @param string $propertyName 
  * @param mixed $propertyValue 
  * @throws ezcBasePropertyNotFoundException
  *          If a property is not defined in this class
  * @return void
  */
 public function __set($propertyName, $propertyValue)
 {
     switch ($propertyName) {
         case 'lineThickness':
         case 'symbolSize':
         case 'highlightSize':
             if (!is_numeric($propertyValue) || $propertyValue < 1) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'int >= 1');
             }
             $this->properties[$propertyName] = (int) $propertyValue;
             break;
         case 'fillLines':
             if ($propertyValue !== false && !is_numeric($propertyValue) || $propertyValue < 0 || $propertyValue > 255) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'false OR 0 <= int <= 255');
             }
             $this->properties[$propertyName] = $propertyValue === false ? false : (int) $propertyValue;
             break;
         case 'highlightFont':
             if ($propertyValue instanceof ezcGraphFontOptions) {
                 $this->properties['highlightFont'] = $propertyValue;
             } elseif (is_string($propertyValue)) {
                 if (!$this->properties['highlightFontCloned']) {
                     $this->properties['highlightFont'] = clone $this->font;
                     $this->properties['highlightFontCloned'] = true;
                 }
                 $this->properties['highlightFont']->path = $propertyValue;
             } else {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'ezcGraphFontOptions');
             }
             break;
             $this->properties['highlightSize'] = max(1, (int) $propertyValue);
             break;
         case 'highlightRadars':
             if (!is_bool($propertyValue)) {
                 throw new ezcBaseValueException($propertyName, $propertyValue, 'bool');
             }
             $this->properties['highlightRadars'] = $propertyValue;
             break;
         default:
             return parent::__set($propertyName, $propertyValue);
     }
 }
 /**
  * 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);
     }
 }
 /**
  * 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);
     }
 }