public function FlotPie::buildOptionsForm in Flot 8
Provide a form to edit options for this plugin.
Overrides StylePluginBase::buildOptionsForm
File
- flot_views_pie/
src/ Plugin/ views/ style/ FlotPie.php, line 37
Class
- FlotPie
- Style plugin to render a list of numbers as a pie chart.
Namespace
Drupal\flot_views_pie\Plugin\views\styleCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
// Create an array of allowed columns from the data we know.
$field_names = $this->displayHandler
->getFieldLabels();
$form['labels'] = [
'#title' => $this
->t('The field that contains the chart labels'),
'#type' => 'select',
'#options' => $field_names,
'#default_value' => $this->options['labels'],
];
$form['values'] = [
'#title' => $this
->t('The field that contains the chart data'),
'#type' => 'select',
'#options' => $field_names,
'#default_value' => $this->options['values'],
];
$form['pie_or_bar'] = [
'#type' => 'radios',
'#title' => $this
->t('Chart Type'),
'#options' => array(
'pie' => $this
->t('Pie Chart'),
'bar' => $this
->t('Bar Chart'),
),
'#default_value' => $this->options['pie_or_bar'],
'#description' => $this
->t('Should the categorical data be rendered in a pue chart or bar chart?'),
];
}