<canvas id="canvas" width="1024" height="600"></canvas>
<script type="text/JavaScript">
var ctx = document.getElementById('canvas').getContext('2d');
ctx.beginPath();
ctx.strokeStyle = 'blue';
ctx.moveTo(30, 30);
ctx.lineTo(200, 30);
ctx.lineTo(130, 130);
ctx.closePath(); // draw the last line of the triangle
ctx.stroke();
</script>