Piwik\DataTable\Filter\
Calculates a percentage value for each row of a DataTable and adds the result to each row.
See ColumnCallbackAddColumnQuotient for more information.
Basic usage example
$nbVisits = // ... get the visits for a period ...
$dataTable->queueFilter('ColumnCallbackAddColumnPercentage', array('nb_visits', 'nb_visits_percentage', $nbVisits, 1));
The class defines the following methods:
__construct() ash; Constructor. Inherited from ColumnCallbackAddColumnQuotientfilter() ash; See ColumnCallbackAddColumnQuotient. Inherited from ColumnCallbackAddColumnQuotientenableRecursive() ash; Enables/Disables recursive filtering. Inherited from BaseFilterfilterSubTable() 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.