AJAX and Canvas | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

AJAX and Canvas

Hello, i'm experimenting a bit with an esp32 and a network. The ESP32 measures a temperature which I then display on a web page. This works with AJAX etc. The temperature value is cyclically sent and displayed. Now I want to display the temperature as a graph. For example with a pointer. Can anyone help me with a simple example? I do not understand the use of CANVAS in this problem. many thanks and greetings

31st Jan 2020, 12:25 PM
Jürgen
6 Answers
+ 4
Do you wanna draw something like a chart ? I think you can use chart.js https://code.sololearn.com/WeD60RcuAtZ3/?ref=app
31st Jan 2020, 12:39 PM
Pedro H.J
Pedro H.J - avatar
+ 4
See this video https://youtu.be/PVPQR7tMtHc Do you want something like this ?
31st Jan 2020, 1:28 PM
Pedro H.J
Pedro H.J - avatar
+ 2
31st Jan 2020, 12:37 PM
Pedro H.J
Pedro H.J - avatar
+ 1
https://www.sololearn.com/learn/HTML/2201/ Das geht nicht...
31st Jan 2020, 1:19 PM
Jürgen
0
Hello, Thanks for the info. Unfortunately the first link does not work. I understand how something is drawn with canvas, it works too. Unfortunately I can't manage to update the canvas drawing regularly. This is my problem. The numerical values are updated, that works. Regards...
31st Jan 2020, 1:18 PM
Jürgen
0
Hi, thanks for the Example. Here is my Code: https://code.sololearn.com/WNA2eThYsZq8/#html A canvas drawing area is created and a red rectangle and line are drawn. I want the line to be drawn differently depending on the value. So like a hand of a clock. I do not want to work with the Chart Lib. It is called GetAjaxData every 250ms and the values are displayed as numbers. I would like to draw a pointer parallel to this. greetings...
31st Jan 2020, 5:16 PM
Jürgen