I have drawn a bunch of rectangles using canvas, now i want text to appear inside the boxes.
I have all the coordinates of the boxes, is there any way i can give text coordinates so they appear in the box?
var Rad = 10
var Kolonne = 10
var Bredde = 350
var Høyde = 100
var Kolonnetall=0
var MellomromKolonne=100
var MellomromRad=25
btnTegn.onclick=function(){
for (var i = 0; i < 15; i++) {
ctx.beginPath();
ctx.rect(Kolonne,Rad,Bredde,Høyde)
ctx.moveTo(Bredde/2+Kolonne,Rad)
ctx.lineTo(Bredde/2+Kolonne,Rad+Høyde)
ctx.stroke();
Rad+=MellomromRad+Høyde
Kolonnetall++
if (Kolonnetall==5) {
Rad=10
Kolonne+=Bredde+MellomromKolonne
Kolonnetall=0
}
}
}
As you can see, i am making rectangels with a line in bewtween. I would like to be able to add text to them.