This page demonstrates the core Canvas 2D drawing operations. Each canvas below shows a different category of drawing. Open the page source (Ctrl+U / Cmd+Opt+U) and read the JavaScript comments to understand each call.
ctx1.fillStyle = 'red'; ctx1.fillRect(300, 50, 80, 80); to add a red square to the first canvas.
The origin (0, 0) is the top-left corner. X increases to the right, Y increases downward.
fillRect(x, y, w, h), strokeRect(x, y, w, h), and clearRect(x, y, w, h).
beginPath(), moveTo(), lineTo(), closePath(), stroke(), fill().
arc(x, y, radius, startAngle, endAngle) draws circular arcs. Angles are in radians.
fillText(str, x, y) and strokeText(str, x, y). Use textAlign and textBaseline for positioning.
A simple bar chart drawn with the methods above, proving that basic drawing primitives are all you need.