function _quant_generate_chart_multiple in Quant 6
Take formatted data for a multi-point chart and convert to a format that the charts can understand
File
- includes/
chart.inc, line 208 - Chart building functions
Code
function _quant_generate_chart_multiple(&$quant) {
$max = 0;
// Determine the highest available value on y-axis
$interval = 0;
// Counter to help break the x-axis label
$x = FALSE;
// Only register the x-axis labels once
foreach ($quant->data as $type => $values) {
// Set type as a legend
$quant->chart['#legends'][] = $type;
// Period when to break x-axis
$period = ceil(count($data[$type]) / 10);
foreach ($values as $date => $value) {
$quant->chart['#data'][$type][] = $value;
$max = max($max, $value);
if (!$x) {
// Only set x-axis labels once
if (!$interval) {
quant_x_label($quant, $date);
$interval = $period;
}
$interval--;
}
}
$x = TRUE;
// x-axis labels have been set
}
quant_y_range($quant, 0, $max);
$quant->render = chart_render($quant->chart);
}