You are here

function google_chart_tools_views_plugin_style::options_form in Google Chart Tools 7

Provide a form to edit options for this plugin.

Overrides views_plugin_style::options_form

File

google_chart_tools_views/views/google_chart_tools_views_plugin_style.inc, line 32
Contains the Google Chart Tools display plugin.

Class

google_chart_tools_views_plugin_style
The views style plugin.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // Only allow grouping on the first column.
  $form['grouping'] = array_slice($form['grouping'], 0, 1);
  $form['grouping'][0]['field']['#options'] = array_slice($form['grouping'][0]['field']['#options'], 0, 2);
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#description' => t('Chart title. You may use "%" in your text to represent values that will be used for contextual filters.'),
    '#default_value' => $this->options['title'],
  );
  $form['haxis_title'] = array(
    '#type' => 'textfield',
    '#title' => t('hAxis Title'),
    '#description' => t('Horizontal axis title. You may use "%" in your text to represent values that will be used for contextual filters.'),
    '#default_value' => $this->options['haxis_title'],
  );
  $form['vaxis_title'] = array(
    '#type' => 'textfield',
    '#title' => t('vAxis Title'),
    '#description' => t('Vertical axis title. You may use "%" in your text to represent values that will be used for contextual filters.'),
    '#default_value' => $this->options['vaxis_title'],
  );
  $form['type'] = array(
    '#type' => 'select',
    '#options' => google_chart_tools_load_types(),
    '#title' => t('Type'),
    '#description' => t('Chart type, see <a href="https://google-developers.appspot.com/chart/interactive/docs/gallery">Google Chart Tools gallery</a>.'),
    '#required' => TRUE,
    '#description' => t('Ex. LineChart, PieChart, ColumnChart, AreaChart, Gauge, BarChart, etc....'),
    '#default_value' => $this->options['type'],
  );
  $form['width'] = array(
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#description' => t('Chart width in pixels'),
    '#size' => 8,
    '#required' => TRUE,
    '#default_value' => $this->options['width'],
  );
  $form['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#description' => t('Chart height in pixels'),
    '#size' => 8,
    '#required' => TRUE,
    '#default_value' => $this->options['height'],
  );
  $form['curve'] = array(
    '#type' => 'checkbox',
    '#title' => t('Curve'),
    '#description' => t('Use a curve function'),
    '#default_value' => $this->options['curve'],
  );
  $form['3d'] = array(
    '#type' => 'checkbox',
    '#title' => t('3D'),
    '#description' => t('Make chart 3D'),
    '#default_value' => $this->options['3d'],
  );
  $form['isstacked'] = array(
    '#type' => 'checkbox',
    '#title' => t('Stack results'),
    '#description' => t('Render Bar Chart items on top of each other'),
    '#default_value' => $this->options['isstacked'],
  );
  $form['pointsize'] = array(
    '#type' => 'textfield',
    '#title' => t('Data point size'),
    '#description' => t('Pixel radius to allow for datapoints to be sized'),
    '#size' => 10,
    '#default_value' => $this->options['pointsize'],
  );
  $form['colors'] = array(
    '#type' => 'textfield',
    '#title' => t('Colors'),
    '#description' => t('A color strings separated by commas. Ex. red, #004411'),
    '#size' => 32,
    '#default_value' => $this->options['colors'],
  );
}