PieGraph::CheckValues PHP Method

CheckValues() protected method

Checks that the data are valid
protected CheckValues ( &$values )
    protected function CheckValues(&$values)
    {
        parent::CheckValues($values);
        if ($this->GetMinValue() < 0) {
            throw new Exception('Negative value for pie chart');
        }
        if (array_sum($values[0]) <= 0) {
            throw new Exception('Empty pie chart');
        }
    }

Usage Example

 /**
  * Checks that the data are valid
  */
 protected function CheckValues()
 {
     parent::CheckValues();
     $this->largest_value = $this->GetMaxValue();
     $this->smallest_value = $this->largest_value;
     // want smallest non-0 value
     foreach ($this->values[0] as $item) {
         if ($item->value < $this->smallest_value) {
             $this->smallest_value = $item->value;
         }
     }
 }