You are here

protected function ChartsGraphsBluff::_initialize_final_parameters in Charts and Graphs 7

Same name and namespace in other branches
  1. 6.2 apis/charts_graphs_bluff/charts_graphs_bluff.class.inc \ChartsGraphsBluff::_initialize_final_parameters()
1 call to ChartsGraphsBluff::_initialize_final_parameters()
ChartsGraphsBluff::get_chart in apis/charts_graphs_bluff/charts_graphs_bluff.class.inc
Function that renders data.

File

apis/charts_graphs_bluff/charts_graphs_bluff.class.inc, line 79
Implementation of abstract class ChartsGraphsCanvas for Bluff library.

Class

ChartsGraphsBluff
Implementation of abstract class ChartsGraphsCanvas for Bluff library.

Code

protected function _initialize_final_parameters($chart_id) {
  $parameters = array();
  $parameters['marker_font_size'] = 20;
  $parameters['hide_legend'] = 'true';
  $parameters['hide_title'] = 'false';
  $parameters['sort'] = 'false';
  $parameters['title_font_size'] = (int) $this->title_font_size;
  $parameters['tooltips'] = 'true';

  /**
   * Applying user defined min, max and step for y axis values.
   */
  if ($this->y_min) {
    $parameters['minimum_value'] = $this->y_min;
  }
  if ($this->y_max) {
    $parameters['maximum_value'] = $this->y_max;
  }
  if ($this->y_step) {
    $parameters['y_axis_increment'] = $this->y_step;
  }
  if (isset($this->theme) && !empty($this->theme)) {
    $parameters['theme_' . $this->theme] = array();
  }
  else {
    $series_colours = "['" . implode("', '", $this->series_colours) . "']";
    $marker_colour = '#aea9a9';
    $font_colour = '#000000';
    $background_colour = isset($this->colour) ? array(
      $this->colour,
      $this->colour,
    ) : array(
      '#d1edf5',
      '#ffffff',
    );
    $background_colour = "['" . implode("', '", $background_colour) . "']";
    $set_theme = sprintf("{\n          colors: %s,\n          marker_color: '%s',\n          font_color: '%s',\n          background_colors: %s\n        }", $series_colours, $marker_colour, $font_colour, $background_colour);
    $parameters['set_theme'] = array(
      $set_theme,
    );
  }
  $parameters['data_from_table'] = array(
    '"' . $chart_id . '"',
    "{orientation: '" . ($this->orientation ? $this->orientation : 'auto') . "'}",
  );
  if (is_array($this->parameters)) {
    foreach ($this->parameters as $user_parameter_key => $user_parameter) {
      $parameters[$user_parameter_key] = $user_parameter;
    }
  }
  $this->final_parameters = $parameters;
}