Piwik\DataTable\Filter\
Calculates the quotient of two columns and adds the result as a new column for each row of a DataTable.
This filter is used to calculate rate values (eg, 'bounce_rate'
), averages
(eg, 'avg_time_on_page'
) and other types of values.
Basic usage example
$dataTable->queueFilter('ColumnCallbackAddColumnQuotient', array('bounce_rate', 'bounce_count', 'nb_visits', $precision = 2));
The class defines the following methods:
__construct()
— Constructor.filter()
ash; See ColumnCallbackAddColumnQuotient.enableRecursive()
ash; Enables/Disables recursive filtering. Inherited from BaseFilter
filterSubTable()
ash; Filters a row's subtable, if one exists and is loaded in memory. Inherited from BaseFilter
__construct()
Constructor.
It accepts the following parameter(s):
$table
(DataTable
) —
$columnNameToAdd
(string
) —
The name of the column to add the quotient value to.
$columnValueToRead
(string
) —
The name of the column that holds the dividend.$divisorValueOrDivisorColumnName
(Piwik\DataTable\Filter\number
|string
) —
Either numeric value to use as the divisor for every row, or the name of the column whose value should be used as the divisor.$quotientPrecision
(int
) —
The precision to use when rounding the quotient.$shouldSkipRows
(bool
|Piwik\DataTable\Filter\number
) —
Whether rows w/o the column to read should be skipped or not.$getDivisorFromSummaryRow
(bool
) —
Whether to get the divisor from the summary row or the current row iteration.filter()
See ColumnCallbackAddColumnQuotient.
It accepts the following parameter(s):
$table
(DataTable
) —It does not return anything or a mixed result.
enableRecursive()
Enables/Disables recursive filtering. Whether this property is actually used is up to the derived BaseFilter class.
It accepts the following parameter(s):
$enable
(bool
) —It does not return anything or a mixed result.
filterSubTable()
Filters a row's subtable, if one exists and is loaded in memory.
$row
(Row
) —
The row whose subtable should be filter.