You are here

function ChartsAmcharts::_preprocess_values_not_pie in Charts and Graphs 6

1 call to ChartsAmcharts::_preprocess_values_not_pie()
ChartsAmcharts::_preprocess_values in apis/amcharts/amcharts.class.inc

File

apis/amcharts/amcharts.class.inc, line 66
Implementation of abstract class ChartCanvas for amCharts library.

Class

ChartsAmcharts
Implementation of abstract class ChartCanvas for amCharts library.

Code

function _preprocess_values_not_pie() {
  $out = "<chart><series>\n";
  if (is_array($this->x_labels)) {
    $i = 1;
    foreach ($this->x_labels as $label) {
      $out .= "<value xid='{$i}'>{$label}</value>\n";
      $i++;
    }
  }
  $out .= "</series><graphs>\n";
  if (is_array($this->series)) {
    foreach ($this->series as $name => $graph) {
      $out .= "<graph title='{$name}' bullet='round'";
      if (strpos($this->type, 'area') !== FALSE) {
        $out .= " fill_alpha='50'";
      }
      $out .= ">\n";
      if (is_array($graph)) {
        $j = 1;
        foreach ($graph as $val) {
          $out .= "<value xid='{$j}'>{$val}</value>\n";
          $j++;
        }
      }
      $out .= "</graph>\n";
    }
  }
  $out .= "</graphs></chart>\n";
  return $out;
}