You are here

protected function Chartjs::buildLegend in Charts 8.3

Parameters

$options:

Return value

\stdClass

1 call to Chartjs::buildLegend()
Chartjs::buildOptions in modules/charts_chartjs/src/Plugin/chart/Chartjs.php
Build the options.

File

modules/charts_chartjs/src/Plugin/chart/Chartjs.php, line 153

Class

Chartjs
Define a concrete class for a Chart.

Namespace

Drupal\charts_chartjs\Plugin\chart

Code

protected function buildLegend($options) {
  $legend = new \stdClass();
  if (isset($options['legend']) && !empty($options['legend_position']) && $options['legend'] == TRUE) {
    $legend->display = TRUE;
    $legend->position = $options['legend_position'];
  }
  else {
    $legend->display = FALSE;
  }
  return $legend;
}