Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

ADAVANCE JAVA PROGRAMMING, Cheat Sheet of Java Programming

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

2021/2022

Available from 03/27/2023

dhruv-7
dhruv-7 🇮🇳

5 documents

1 / 5

Toggle sidebar

Related documents


Partial preview of the text

Download ADAVANCE JAVA PROGRAMMING and more Cheat Sheet Java Programming in PDF only on Docsity! Subject Code : 3160717 Subject Name : Data Visualization Date :31/01/2023 Enrollment No : 200420107076 Name : Raj Dudhat Practical No. : 2(a) Problem Statement: Draw Line, Rectangle, Circle, Arc, House. Apply different styles. Program: <!DOCTYPE html> <html> <head> <title>Canvas Drawing</title> <style> canvas { border: 1px solid black; } </style> </head> <body> <canvas id="myCanvas" width="400" height="400"></canvas> <script> const canvas = document.getElementById("myCanvas"); const ctx = canvas.getContext("2d"); // Draw a line ctx.beginPath(); ctx.moveTo(50, 50); ctx.lineTo(200, 50); ctx.lineWidth = 5; ctx.strokeStyle = "blue"; ctx.stroke(); // Draw a rectangle ctx.beginPath(); ctx.rect(50, 100, 200, 100); ctx.fillStyle = "yellow"; ctx.fill(); ctx.lineWidth = 3; SCET/CO/2022-23/EVEN/BE Shift-II/Sem-VI Page No : 1 Subject Code : 3160717 Subject Name : Data Visualization Date :31/01/2023 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(); </script> </body> </html> HOUSE: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <canvas id="canvass" height="500px" width="500px" style="border: 2px solid black;"> canvas </canvas> SCET/CO/2022-23/EVEN/BE Shift-II/Sem-VI Page No : 2