public function ChartsApiExample::displayTwo in Charts 8.4
Display Two.
Return value
array Array to render.
1 string reference to 'ChartsApiExample::displayTwo'
- charts_api_example.routing.yml in modules/
charts_api_example/ charts_api_example.routing.yml - modules/charts_api_example/charts_api_example.routing.yml
File
- modules/
charts_api_example/ src/ Controller/ ChartsApiExample.php, line 167
Class
- ChartsApiExample
- Charts Api Example.
Namespace
Drupal\charts_api_example\ControllerCode
public function displayTwo() {
$chart = [];
$chart['example_one'] = [
'#type' => 'chart',
'#chart_type' => 'column',
];
$chart['example_one']['male'] = [
'#type' => 'chart_data',
'#title' => $this
->t('Male'),
'#data' => [
10,
20,
30,
],
];
$chart['example_one']['xaxis'] = [
'#type' => 'chart_xaxis',
'#title' => $this
->t('Month'),
'#labels' => [
$this
->t('Jan'),
$this
->t('Feb'),
$this
->t('Mar'),
],
];
return $chart;
}