Unless you want to give out the same result, you want to do:
return [
'charts' => $output,
'#attached' => [
// Pushing down data to JS.
'drupalSettings' => [
'tc' => $data,
],
// Including our own JS "library". Dependencies for it (like Chart.js,
// Chart.Scatter and jQuery) are handled by tc.libraries.yml.
'library' => [
'tc/tc',
],
],
'#cache' => [
'max-age' => 0,
],
];
Comments
Comment #3
boobaaThanks!