function ad_report_generate_bargraph in Advertisement 6.3
Same name and namespace in other branches
- 5.2 report/ad_report.module \ad_report_generate_bargraph()
- 5 report/ad_report.module \ad_report_generate_bargraph()
- 6 report/ad_report.module \ad_report_generate_bargraph()
- 6.2 report/ad_report.module \ad_report_generate_bargraph()
- 7 report/ad_report.module \ad_report_generate_bargraph()
Page that utilizes the Google chart api to generate a bargraph.
2 calls to ad_report_generate_bargraph()
- ad_report_admin_display in report/
ad_report.module - Display the administrative report.
- ad_report_bargraph in report/
ad_report.module - Page to display ad with bargraph.
File
- report/
ad_report.module, line 777 - Provides comprehensive charts and reports about advertising statistics.
Code
function ad_report_generate_bargraph($data) {
$chart = array(
'#chart_id' => 'ad',
'#type' => CHART_TYPE_LINE,
'#size' => chart_size(600, 400),
// TODO: Calculate these based on the # of days
'#grid_lines' => chart_grid_lines(10, 9.5, 1, 3),
'#adjust_resolution' => TRUE,
);
foreach ($data as $legend => $values) {
switch ($legend) {
case '#max':
$max = $values;
break;
case '#labels':
$chart['#labels'] = $values;
break;
case '#title':
$chart['#title'] = $values;
break;
case '#node':
// we don't use this, but we pass it in case someone altering the
// table needs data from the node object.
break;
default:
$chart['#legends'][] = $legend;
$chart['#data_colors'][] = chart_unique_color($legend);
$chart['#line_styles'][] = chart_line_style(2);
$chart['#data'][$legend] = $values;
}
}
$chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][0][] = chart_mixed_axis_range_label(0, $max);
return chart_render($chart);
}