Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
Giving Text coordinates in Javascript

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!