At the moment you need to specify an array for the x_axis and y_axis when using the API (render array type #chart). It would be nice to make them optional.
From the ChartsApiExample.php
$charts_container['content']['stacked_two_series_column'] = [
'#type' => 'chart',
'#tooltips' => $charts_settings->get('charts_default_settings.display.tooltips'),
'#title' => $this->t('@library Stacked Column Chart (Two Series)', ['@library' => ucfirst($library)]),
'#chart_type' => 'column',
'series_one' => $series,
'series_two' => [
'#type' => 'chart_data',
'#title' => $this->t('8.x-3.x'),
'#data' => [4330, 4413, 4212, 4431],
'#color' => '#77b259',
],
'x_axis' => $xaxis,
'y_axis' => $yaxis,
'#stacking' => TRUE,
'#raw_options' => [],
];
But sometimes you may only use #raw_options. The series attribute is already optional, but if you do not specify x_axis or y_axis you get an error:
The website encountered an unexpected error. Please try again later.
TypeError: array_map(): Argument #2 ($array) must be of type array, null given in array_map() (line 137 of modules/contrib/charts_echarts/src/Plugin/chart/Library/Echarts.php).
Fixed
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.