public function postFormatRecords(array &$records = NULL)
 {
     parent::postFormatRecords($records);
     if (!isset($records)) {
         return;
     }
     $valueMin = NULL;
     $valueMax = NULL;
     // preparing minimum and maximum values
     foreach ($records as $record) {
         if (!isset($record[$this->valuePropertyName])) {
             continue;
         }
         $value = $record[$this->valuePropertyName];
         $valueMin = MathHelper::min($valueMin, $value);
         $valueMax = MathHelper::max($value, $valueMax);
     }
     // generating weighted grade
     foreach ($records as &$record) {
         if (!isset($record[$this->valuePropertyName])) {
             continue;
         }
         $value = $record[$this->valuePropertyName];
         $weightedGrade = ($value - $valueMin) / ($valueMax - $valueMin);
         $record[$this->weightedGradeProperyName] = $weightedGrade;
     }
 }
 public function postFormatRecords(array &$records = NULL)
 {
     parent::postFormatRecords($records);
     if (!isset($records)) {
         return;
     }
     // calculating total amounts
     $totals = NULL;
     foreach ($this->amountPropertyNames as $amountPropertyName) {
         $totals[$amountPropertyName] = 0.0;
     }
     foreach ($records as $record) {
         foreach ($this->amountPropertyNames as $amountPropertyName) {
             $amount = $record[$amountPropertyName];
             if (isset($amount)) {
                 $totals[$amountPropertyName] += $amount;
             }
         }
     }
     // calculating percents
     foreach ($records as &$record) {
         foreach ($this->amountPropertyNames as $amountPropertyName) {
             $amount = $record[$amountPropertyName];
             if (isset($amount)) {
                 $total = $totals[$amountPropertyName];
                 $percent = $total == 0.0 ? 'N/A' : $amount / $total;
                 $percentPropertyName = '';
                 if (isset($this->generatedColumnPrefix)) {
                     $percentPropertyName = $this->generatedColumnPrefix . $percentPropertyName;
                 }
                 $percentPropertyName .= $amountPropertyName;
                 if (isset($this->generatedColumnSuffix)) {
                     $percentPropertyName .= $this->generatedColumnSuffix;
                 }
                 $record[$percentPropertyName] = $percent;
             }
         }
     }
     unset($record);
 }