S
S
Seryoga2016-12-21 04:20:00
Canvas
Seryoga, 2016-12-21 04:20:00

How to display a variable in ctx.fillText("variable", 10, 10)?

Googled a lot but couldn't find an answer. There is a variable "X" - these are the readings of a certain sensor from 0 to 9999.
You need to display these readings in a certain place. But I can't figure out how to insert a variable instead of text:
ctx.fillText( X , 10, 10)
I tried it in different ways, but either the text "X" is displayed, or the page does not work at all, sometimes instead of the text and the value of the variable it displays "[object Object]
How do you put a variable in there ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Seryoga, 2016-12-21
@sirocco

Probably I didn't start the problem correctly. Using php code, I get data from a database (MariaDB). Then I need to display them in html5, not just display, but dynamically update. I did this with Ajax. The data is pulled from the database by the php script, and on the page it is updated by Ajax and entered into "X". But this "X" already needs to be drawn on the canvas.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question