Hi,
I’ve got a problem with ChartJS. I’m trying to print results of the survey to the user, so there are a lots of ‘canvases’ in the template. Drawing charts happens when the template should be ready:
Template.results.onRendered(function () {
var testData = some test data;
var test = document.getElementById(‘test1’).getContext(“2d”);
new Chart(test).Bar(testData);
});
The template looks like this:
<template name="results"> <div class="container text-center"> {{#each survey}} <canvas id="{{name}}" width="800" height="300"></canvas> {{/each}} </div> </template>
But unfortunately I get ‘TypeError: Cannot read property ‘getContext’ of null’ error.
Any ideas?