<html>
<body>
<canvas id="myCanvas" width="400" height="400" style="border:1px solid grey"></canvas>
<script>
const canvas = document.getElementById("myCanvas");
const ctx = canvas.getContext("2d");
let xMax = canvas.height = canvas.width;
ctx.transform(1, 0, 0, -1, 0, xMax)
let slope = 1.2;
let intercept = 70;
ctx.beginPath();
ctx.moveTo(0, intercept);
ctx.lineTo(xMax, xMax * slope + intercept);
ctx.stroke();
</script>
</body>
<!-- Mirrored from www.w3schools.com/ai/tryit.asp?filename=tryai_canvas_line by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 16:51:32 GMT -->
</html>