You are here

public function ViewsSimplechart::buildOptionsForm in Views Simple Chart 8

Render the given style.

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/ViewsSimplechart.php, line 56

Class

ViewsSimplechart
Style plugin to render each item in an ordered or unordered list.

Namespace

Drupal\views_simplechart\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['chart_title'] = [
    '#title' => t('Chart Title'),
    '#type' => 'textfield',
    '#size' => '60',
    '#default_value' => $this->options['chart_title'],
  ];
  $form['chart_axis_mapping'] = [
    '#title' => t('Chart Axis Mapping'),
    '#type' => 'textfield',
    '#description' => t('Each axis need to be placed as comma(,) separtor.'),
    '#size' => '60',
    '#default_value' => $this->options['chart_axis_mapping'],
  ];
  $form['chart_type'] = [
    '#type' => 'radios',
    '#title' => t('Chart type'),
    '#options' => [
      'BarChart' => t('Bar Chart'),
      'PieChart' => t('Pie Chart'),
      'LineChart' => t('Line Chart'),
      'ColumnChart' => t('Column Chart'),
      'Timeline' => t('Timeline'),
      'OrgChart' => t('Organization Chart'),
    ],
    '#default_value' => $this->options['chart_type'],
  ];
  $form['chart_type_stacked'] = [
    '#type' => 'radios',
    '#title' => t('Do you want Stack in Graph?'),
    '#options' => [
      'yes' => t('Yes'),
      'no' => t('No'),
    ],
    '#description' => t('This is applicable only for Bar and Column chart.'),
    '#default_value' => $this->options['chart_type_stacked'],
  ];
  $form['chart_legend_position'] = [
    '#type' => 'radios',
    '#title' => t('Chart Legend Position'),
    '#options' => [
      'left' => t('Left'),
      'right' => t('Right'),
      'top' => t('Top'),
      'bottom' => t('Bottom'),
    ],
    '#default_value' => $this->options['chart_legend_position'],
  ];
  $form['chart_width'] = [
    '#title' => t('Chart Width'),
    '#type' => 'textfield',
    '#size' => '60',
    '#default_value' => $this->options['chart_width'],
  ];
  $form['chart_height'] = [
    '#title' => t('Chart Height'),
    '#type' => 'textfield',
    '#size' => '60',
    '#default_value' => $this->options['chart_height'],
  ];
}