I am new to Drupal 8. I am trying to implement Chart js in Drupal 8.
I am trying to create a <canvas>
element to load the chart. But while rendering the page, <canvas>
element is getting removed automatically.
Below the controller code.
class DashboardController extends ControllerBase {
public function content() {
return array(
'#type' => 'markup',
'#markup' => '<div class="chart"><canvas id="test"></canvas></div>',
);
}
}
Here, I am getting only <div class="chart"></div>
I am unable to find the canvas in the page. Because of that, chart is not getting loaded.
Anyone help me to figure out the exact problem.