I'm working on a project with meteor
using handlebars (clearly), but ran into a problem, I need to dynamically graph data
so I'm using the #each
to loop into all my events
<ul class="collection">
{{#each events}}
{{#if currentUser}}
<li class="collection-item">
<div class="row">
<div class="col s4">
{{topic}}
<canvas id="myChart" width = "500"></canvas>
the problem starts when there's more than 1 graph because the id
of the canvas needs to be different each time, so can be accessed it on the JS file like this:
var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
type: 'line',
data: {
I'm new to meteor
and handlebars
and don't know if there's a way to give a different id
to each chart
or a different way to access to the getelementbyid.getcontext
.
Hope I was clear and hope you can help me please