<canvas id="myCanvas" width="578" height="200"></canvas>
<p>
How html context 2d works is you start a path with beginPath().
Then draw a line by addressing the starting point the line should draw at using ctx.moveTo().
then when you tell from there, where to draw to using ctx.lineTo().
You make as many lineTo calls as needed.
Then to draw the line use ctx.stroke();
To connect the line back to where its starting point, use ctx.closePath() followed by stroke();
then you can fill the shape using ctx.fill();
</p>
<div id="img-container" style="border: thin solid red">
</div>