. */ /** * For more information, please contact */ namespace Goat1000\SVGGraph; /** * Deal with the strange way population pyramids work */ class PopulationPyramidAverage extends Average { private $graph; private $lines = []; /** * Calculates the mean average for a dataset */ protected function calculate(&$values, $dataset) { $val = parent::calculate($values, $dataset); if($val === null) return $val; return $dataset % 2 ? $val : -$val; } /** * Need to sign-correct the average value for display */ protected function getTitle(&$graph, $avg, $dataset) { return parent::getTitle($graph, $dataset % 2 ? $avg : -$avg, $dataset); } }