public function visualization_plugin_style::options_form in Visualization API 7
Returns the options form.
Overrides views_plugin_style::options_form
File
- includes/
views/ visualization_plugin_style.inc, line 37 - Views style plugin for Visualization.
Class
- visualization_plugin_style
- Style plugin uses views ui to configure views data for rendering charts.
Code
public function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$fields = $this->display->handler
->get_field_labels();
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Chart Title'),
'#default_value' => $this->options['title'],
'#description' => t('Enter a custom title for this chart.'),
);
$form['type'] = array(
'#type' => 'select',
'#title' => t('Chart type'),
'#options' => array(
'line' => 'Line chart',
'pie' => 'Pie chart',
'bar' => 'Bar chart',
'column' => 'Column chart',
),
'#default_value' => $this->options['type'],
'#empty_value' => FALSE,
);
$form['fields'] = array(
'#type' => 'fieldset',
'#title' => t('Field settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
foreach ($fields as $field => $column) {
$form['fields'][$field] = array(
'#type' => 'fieldset',
'#title' => check_plain($field),
'#collapsible' => TRUE,
'#collapsed' => empty($this->options['fields'][$field]),
);
$form['fields'][$field]['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enable this field in the chart'),
'#default_value' => $this->options['fields'][$field]['enabled'],
'#dependency' => array(
'style_options',
'fields',
$field,
'type',
),
);
}
$form['xAxis'] = array(
'#type' => 'fieldset',
'#title' => t('X-axis settings'),
'#collapsible' => TRUE,
'#collapsed' => !empty($this->options['xAxis']['labelField']) || !empty($this->options['xAxis']['invert']),
);
$form['xAxis']['labelField'] = array(
'#type' => 'select',
'#title' => t('X-axis labels'),
'#options' => $fields,
'#default_value' => $this->options['xAxis']['labelField'],
'#empty_value' => FALSE,
);
$form['xAxis']['invert'] = array(
'#type' => 'checkbox',
'#title' => t('Should the x-axis get inverted?'),
'#default_value' => $this->options['xAxis']['invert'],
);
$form['yAxis'] = array(
'#type' => 'fieldset',
'#title' => t('Y-axis settings'),
'#collapsible' => TRUE,
'#collapsed' => empty($this->options['yAxis']['title']),
);
$form['yAxis']['title'] = array(
'#type' => 'textfield',
'#title' => t('Y-axis title'),
'#default_value' => $this->options['yAxis']['title'],
);
}