Calculates the average value of a row or column of data. Note that in an ideal world the column / row will only contain numerical data. Either way, Excel will allow strings - they should (in theory) be ignored. Either that or they get counted as 1 (integer one).
Example usage:
// This examples adds an average as the last row of reportData
// simple test class with other methods ignored
class testReport extends reportBase {
function _run() {
// insert other rows above, now add some sums to the columns
// our reportData contains, col1,2...4 and a total
$this->getReportData()->addRow(
array(
'col3' => new reportDataAverage(0, 3, $this->getReportData()->sumColumn('col3')/$this->getReportData()->getCount()), // avg only col3
)
);
}
}
public __construct([$inRow = null], [$inColumn = null], [$inStringValue = 0], [$inStringFormat = null], [$inOptions = array()])
Creates a new instance
public reset()
Resets the object to defaults
public render($startRow, $startCol, $endRow, $endCol, [$sheetRowStart = 5])
Returns the sum formula in Excel format
Posted by: Scorpio Documentor (Writer), in Report on 08 May 2010 @ 16:46
Tags: countable, iteratoraggregate, report, reportdataabstract, reportdataaverage, traversable,
This
work is licenced under a
Creative Commons Licence.