



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A practical exercise for a Data Visualization course, where the student is asked to draw different shapes using the Canvas element in HTML. The program code is provided, and the student is expected to apply different styles to each shape. The shapes include a line, a rectangle, a circle, an arc, and a house. useful as study notes or as an assignment for a Data Visualization course.
Typology: Cheat Sheet
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Enrollment No : 200420107076 Name : Raj Dudhat
Draw Line, Rectangle, Circle, Arc, House. Apply different styles.
Canvas Drawing
Enrollment No : 200420107076 Name : Raj Dudhat ctx.strokeStyle = "red"; ctx.stroke(); // Draw a circle ctx.beginPath(); ctx.arc(200, 250, 50, 0, 2 * Math.PI); ctx.fillStyle = "lightgreen"; ctx.fill(); ctx.lineWidth = 5; ctx.strokeStyle = "green"; ctx.stroke(); // Draw an arc ctx.beginPath(); ctx.arc(100, 250, 50, Math.PI / 4, (3 * Math.PI) / 4); ctx.lineWidth = 2; ctx.strokeStyle = "purple"; ctx.stroke();
HOUSE:
Document
canvas
Enrollment No : 200420107076 Name : Raj Dudhat context.beginPath(); context.rect(150, 300, 200, 200); context.lineWidth = 5; context.strokeStyle = "red"; context.fillStyle = "brown"; context.fill(); context.stroke(); context.beginPath(); context.rect(225, 400, 50, 100); context.lineWidth = 5; context.strokeStyle = "black"; context.fillStyle = "green"; context.fill(); context.stroke(); context.beginPath(); context.moveTo(100, 300); context.lineTo(400, 300); context.lineWidth = 5; context.strokeStyle = "purple"; context.lineTo(250, 200); context.closePath(); context.fillStyle = "blue"; context.fill(); context.stroke();
Enrollment No : 200420107076 Name : Raj Dudhat