You are here

function _format_report_percentage in Acquia Lift Connector 7.2

Formats a percentage value for use in reports.

Parameters

$value: The number to show as a percentage.

bool $include_sign: True to include positive/negative sign indicators.

$trim: Boolean indicating whether the number should be trimmed of trailing 0s.

$decimals: The number of decimal places to display.

$padding: The total number of characters (including decimal) for padding of the final number. This allows numbers to align properly in column views. This will have no effect if trim is set to true.

Return value

string The formatted number to display.

5 calls to _format_report_percentage()
AcquiaLiftLearnReport::doComparisons in includes/AcquiaLiftLearnReport.inc
Runs a t-test comparing $variation to each of the $other_variations.
AcquiaLiftLearnReport::getAggregatedData in includes/AcquiaLiftLearnReport.inc
Returns the per-variation confidence report data aggregated over dates.
AcquiaLiftLearnReport::getDailyData in includes/AcquiaLiftLearnReport.inc
Gets the per-day confidence report from the report data source.
_extract_daily_data in ./acquia_lift.admin.inc
Extracts daily stats from the reporting API into results that can be displayed.
_extract_experiment_results in ./acquia_lift.admin.inc
Extracts aggregated stats from the reporting API into results that can be displayed.

File

./acquia_lift.admin.inc, line 2816
acquia_lift.admin.inc Provides functions needed for the admin UI.

Code

function _format_report_percentage($value, $include_sign = FALSE, $trim = TRUE, $decimals = 2, $padding = 1) {
  $percent = (double) $value * 100;
  if ($percent > 0 && $include_sign) {
    return '+' . _format_report_number($percent, $trim, $decimals, $padding) . '%';
  }
  return _format_report_number($percent, $trim, $decimals, $padding) . '%';
}