2๐
โ
So in order to reference the canvas, I appended the forloop index to the canvas id:
<canvas id="myChart{{ forloop.counter0 }}" width="600" height="400">
And then to reference the canvas within the chart.js context:
var ctx = document.getElementById("myChart" + {{ forloop.counter0 }}).getContext('2d');
๐คMark__C
- [Django]-Django debug toolbar and django 1.9 escaped html in queries inspect
- [Django]-Django only adding one field from model
- [Django]-Django Uploaded images not displayed in production
- [Django]-DJANGO CHECK CONSTRAINTS: SystemCheckError: (models.E032) constraint name 'age_gte_18' is not unique amongst models
- [Django]-Django Prepopulated Fields with two/three letter words
Source:stackexchange.com