You are here

function _openflashchart_series_generic in Charts 7

1 call to _openflashchart_series_generic()
_openflashchart_series in openflashchart/openflashchart.inc
Convert all Series-level data.

File

openflashchart/openflashchart.inc, line 90
@author Bruno Massa http://drupal.org/user/67164

Code

function _openflashchart_series_generic(&$chart, &$data, $series) {
  static $max;

  // Get only the numeric values from the series
  $series_data = _charts_series_values($data[$series]);
  $chart
    ->set_data($series_data);

  // Get the highest value on the series, to be a reference point
  $max = $max < max($series_data) ? max($series_data) : $max;

  // Y labels
  $chart
    ->set_y_max($max);

  // X labels
  $value_labels = array();
  $toogle = FALSE;
  foreach (array_keys($series_data) as $value) {
    if (empty($data[$series][$value]['#label'])) {
      $value_labels[] = '';
    }
    else {
      $value_labels[] = $data[$series][$value]['#label'];
      $toogle = TRUE;
    }
  }
  if (!empty($toogle)) {
    $chart
      ->set_x_labels($value_labels);
  }
}