This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Using API canvas HTML
#12
(03.11.2019, 10:26)Erwin van der Zwart Wrote: Hi,

Try this:

1) Create a html named canvas.html with this content
Code:
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="100%" height="100%" style="border:1px solid #000000;"></canvas>
</body>
</html>
2) Upload canvas.html to the background images tab
3) Create a iframe and add source to: /scada/resources/img/canvas.html
4) Add this code to the custom JavaScript
Code:
$(function(){
    $( document ).ready(function() {     
      var f= $('iframe')
        f.load(function(){
      const cvs = f.contents().find('#myCanvas')
      console.log(cvs);
      const ctx = cvs[0].getContext("2d");
      console.log(ctx);
      ctx.moveTo(0,0);
      ctx.lineTo(200,100);
      ctx.stroke();
    })
  });
});
BR,

Erwin

Hi, I have a question about porcentage.
When you put "width="100%" height="100%"" what is the origin? In my frame is a small square.

Thanks
Reply


Messages In This Thread
Using API canvas HTML - by batistacaceres - 27.10.2019, 20:09
RE: Using API canvas HTML - by buuuudzik - 27.10.2019, 22:39
RE: Using API canvas HTML - by batistacaceres - 02.11.2019, 07:37
RE: Using API canvas HTML - by buuuudzik - 02.11.2019, 08:24
RE: Using API canvas HTML - by batistacaceres - 02.11.2019, 17:17
RE: Using API canvas HTML - by buuuudzik - 02.11.2019, 18:12
RE: Using API canvas HTML - by batistacaceres - 03.11.2019, 09:05
RE: Using API canvas HTML - by batistacaceres - 03.11.2019, 12:25
RE: Using API canvas HTML - by DGrandes - 05.11.2019, 15:51
RE: Using API canvas HTML - by Joep - 05.11.2019, 12:48
RE: Using API canvas HTML - by Joep - 05.11.2019, 16:06

Forum Jump: