You are here

function _openflashchart_series_pie in Charts 7

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

File

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

Code

function _openflashchart_series_pie(&$chart, &$data, $series) {

  // Get only the numeric values from the series
  $series_data = _charts_series_values($data[$series]);
  if (empty($series)) {

    // Pieces labels
    $value_labels = array();
    foreach (array_keys($series_data) as $value) {
      if (empty($data[$series][$value]['#label'])) {
        $value_labels[] = '';
      }
      else {
        $value_labels[] = $data[$series][$value]['#label'];
      }
      $color[] = $data[$series][$value]['#color'];
    }
    $chart
      ->pie_values($series_data, $value_labels, array());
    $chart
      ->pie_slice_colours($color);
  }
}