You are here

function _openflashchart_series in Charts 7

Convert all Series-level data.

Parameters

&$chart: Object. The Open Flash Chart object

&$data: Array. The raw data.

1 call to _openflashchart_series()
_openflashchart_charts_render in openflashchart/openflashchart.inc
Implementation of hook_charts_render().

File

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

Code

function _openflashchart_series(&$chart, &$data) {
  foreach (element_children($data) as $series) {

    // Get the color
    $color = empty($data[$series]['#color']) ? '' : $data[$series]['#color'];
    switch ($data['#type']) {
      case 'line2D':
        $chart
          ->line(1, $color);
        break;
      case 'vbar2D':
        $chart
          ->bar(75, $color);
        break;
      case 'vbar3D':
        $chart
          ->bar_3D(75, $color);
        break;
      case 'pie2D':
        $chart
          ->pie(75, '#000000', 'font-size: 12px;');
        break;
      default:
        return t('This type is not possible using %chartplugin', array(
          '%chartplugin' => 'Open Flash Chart',
        ));
    }

    // Insert a new series of values
    if ($data['#type'] != 'pie2D') {
      _openflashchart_series_generic($chart, $data, $series);
    }
    elseif (empty($series)) {
      _openflashchart_series_pie($chart, $data, $series);
    }
  }
}