You are here

function chart_views_plugin_style_chart::options_form in Google Chart Tools: Image Charts 6

Same name and namespace in other branches
  1. 7 chart_views/views/chart_views_plugin_style_chart.inc \chart_views_plugin_style_chart::options_form()

Generate a form for setting options.

File

chart_views/includes/views/chart_views_plugin_style_chart.inc, line 31
Drupal Chart API Views Integration. @Based on the Charts module's Views integration

Class

chart_views_plugin_style_chart
Style plugin to render view as a chart.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['type'] = array(
    '#default_value' => $this->options['type'],
    '#options' => chart_types(),
    '#required' => TRUE,
    '#type' => 'radios',
  );
  $form['width'] = array(
    '#default_value' => $this->options['width'],
    '#description' => t('The chart width, in pixels'),
    '#required' => TRUE,
    '#size' => 8,
    '#type' => 'textfield',
    '#title' => t('Width'),
  );
  $form['height'] = array(
    '#default_value' => $this->options['height'],
    '#description' => t('The chart height, in pixels'),
    '#required' => TRUE,
    '#size' => 8,
    '#type' => 'textfield',
    '#title' => t('Height'),
  );

  // Views Calc related fields
  $form['aggregation_field'] = array(
    '#type' => 'select',
    '#title' => t('Legend field'),
    '#options' => $this
      ->aggregated_field_options(),
    '#default_value' => $this->options['aggregation_field'],
    '#description' => t('Select a field to aggreagate the results on.'),
  );
  $form['values_legend'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show values in legend'),
    '#default_value' => $this->options['values_legend'],
    '#description' => t('If checked, calculated values will be appended in the chart legend.'),
  );
  $form['calc_fields'] = array(
    '#type' => 'select',
    '#title' => t('Operation field'),
    '#options' => $this
      ->aggregated_field_options(),
    '#default_value' => $this
      ->calc_fields(),
    '#multiple' => TRUE,
    '#description' => t('Select field to perform computations on.'),
  );
  $form['calc'] = array(
    '#type' => 'select',
    '#title' => t('Operation'),
    '#options' => $this
      ->calc_options(),
    '#default_value' => $this->options['calc'],
  );
}