You are here

function quant_override_title in Quant 6

Optionally override a chart title

1 call to quant_override_title()
quant_generate_chart in includes/chart.inc
Wrapper for chart generation functions

File

includes/chart.inc, line 30
Chart building functions

Code

function quant_override_title(&$quant) {

  // If the quant wants the sum of item amounts in the title
  if ($quant->labelsum) {
    $sum = 0;
    foreach ($quant->data as $value) {
      if ($quant->dataType == 'multiple') {
        foreach ($value as $amount) {
          $sum = $sum + $amount;
        }
      }
      else {
        $sum = $sum + $value;
      }
    }
    $quant->chart['#title'] = chart_title($quant->label . ' (' . t('Total') . ": {$sum})");
  }
}