function QuantChartChartAPI::title in Quant 7
Helper function to generate the title of the chart
3 calls to QuantChartChartAPI::title()
- QuantChartChartAPI::bar_chart in plugins/
QuantChartChartAPI.inc - Initialize the creation of a bar chart
- QuantChartChartAPI::line_chart in plugins/
QuantChartChartAPI.inc - Initialize the creation of a line chart
- QuantChartChartAPI::pie_chart in plugins/
QuantChartChartAPI.inc - Initialize the creation of a bar chart
File
- plugins/
QuantChartChartAPI.inc, line 164
Class
- QuantChartChartAPI
- QuantChart plugin class to generate charts using chart.module (Chart API)
Code
function title() {
$title = $this->quant->label;
// If the quant wants the sum of item amounts in the title
if ($this->quant->labelsum) {
$sum = 0;
foreach ($this->quant->data->data as $value) {
if ($this->quant->dataType == 'multiple') {
foreach ($value as $amount) {
$sum = $sum + $amount;
}
}
else {
$sum = $sum + $value;
}
}
$title .= ' (' . t('Total: !sum', array(
'!sum' => $sum,
)) . ')';
}
return chart_title($title);
}