You are here

function _quant_generate_chart_single in Quant 6

Take formatted data for a single-point chart and convert to a format that the charts can understand

File

includes/chart.inc, line 167
Chart building functions

Code

function _quant_generate_chart_single(&$quant) {
  $max = 0;

  // Determine the highest available value on y-axis
  $interval = 0;

  // Counter to help break the x-axis label
  $period = ceil(count($quant->data) / 10);

  // Period when to break x-axis
  foreach ($quant->data as $date => $value) {

    // Only show the X label every calculated period
    if (!$interval) {
      quant_x_label($quant, $date);
      $interval = $period;
    }
    $quant->chart['#data'][] = $value;
    $max = max($max, $value);
    $interval--;
  }
  quant_y_range($quant, 0, $max);
  $quant->render = chart_render($quant->chart);
}