Piwik\DataTable\Filter\

ColumnCallbackAddColumnPercentage

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));

Methods

The class defines the following methods:

__construct()

Constructor.

Signature

  • It accepts the following parameter(s):
    • $table (DataTable) — The DataTable that will eventually be filtered.
    • $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.

Signature

  • It accepts the following parameter(s):

  • It does not return anything.