IAT 355 : Lab 01. Web Basics

Similar documents
D3js Tutorial. Tom Torsney-Weir Michael Trosin

Data Visualization (CIS/DSC 468)

About the Tutorial. Audience. Prerequisites. Copyright and Disclaimer. D3.js

CREATING A WEBSITE USING CSS. Mrs. Procopio CTEC6 MYP1

Scalable Vector Graphics (SVG) vector image World Wide Web Consortium (W3C) defined with XML searched indexed scripted compressed Mozilla Firefox

BEFORE CLASS. If you haven t already installed the Firebug extension for Firefox, download it now from

Data Visualization (DSC 530/CIS )

TUTORIAL: D3 (1) Basics. Christoph Kralj Manfred Klaffenböck

HTML5 - SVG. SVG is mostly useful for vector type diagrams like Pie charts, Two-dimensional graphs in an X,Y coordinate system etc.

UI development for the Web.! slides by Anastasia Bezerianos

HTML5. HTML5 Introduction. Form Input Types. Semantic Elements. Form Attributes. Form Elements. Month Number Range Search Tel Url Time Week

D3 Introduction. Gracie Young and Vera Lin. Slides adapted from

Lecture Topic Projects

Data Visualization (CIS 468)

Data Visualization (DSC 530/CIS )

Cascading style sheets, HTML, DOM and Javascript

Data Visualization (DSC 530/CIS )

Positioning in CSS: There are 5 different ways we can set our position:

welcome to BOILERCAMP HOW TO WEB DEV

SEEM4570 System Design and Implementation. Lecture 3 Cordova and jquery

LAST WEEK ON IO LAB. Install Firebug and Greasemonkey. Complete the online skills assessment. Join the mailing list.

Stamp Builder. Documentation. v1.0.0

Introduction to WEB PROGRAMMING

jmaki Overview Sang Shin Java Technology Architect Sun Microsystems, Inc.

Javascript. Daniel Zappala. CS 360 Internet Programming Brigham Young University

CSC Web Programming. Introduction to JavaScript

HCDE 530: Computational Techniques for HCDE Data Visualization in Web, Part 2

CSS.

SEEM4570 System Design and Implementation. Lecture 3 Events

Introduction to using HTML to design webpages

PIC 40A. Midterm 1 Review

Data Visualization (DSC 530/CIS )

Scalable Vector Graphics commonly known as SVG is a XML based format to draw vector images. It is used to draw twodimentional vector images.

Markup Language. Made up of elements Elements create a document tree

ITS331 Information Technology I Laboratory

Designing the Home Page and Creating Additional Pages

HTML5, CSS3, JQUERY SYLLABUS

Visualization Process

Learning to Code with SVG

Lecture Topic Projects 1 Intro, schedule, and logistics 2 Applications of visual analytics, data types 3 Data sources and preparation Project 1 out 4

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017)

In the early days of the Web, designers just had the original 91 HTML tags to work with.

CSS how to display to solve a problem External Style Sheets CSS files

Bioinformatics Resources

JQuery and Javascript

A designers guide to creating & editing templates in EzPz

Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework

USING SVG XML FOR REPRESENTATION OF HISTORICAL GRAPHICAL DATA

Lesson 9: Custom JavaScript Objects

An Brief Introduction to a web browser's Document Object Model (DOM) Lecture 20 COMP110 Spring 2018

JavaScript I.b CSCI311

Scalable Vector Graphics SVG

CSE 154: Web Programming Autumn 2018

week8 Tommy MacWilliam week8 October 31, 2011

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 2

USING SVG XML FOR REPRESENTATION OF HISTORICAL GRAPHICAL DATA

This is the vector graphics "drawing" technology with its technical and creative beauty. SVG Inkscape vectors

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

Assignments (4) Assessment as per Schedule (2)

CMPS 179. UX for Designing 3D, Anima2on, and Interac2on for the Web. Name Professors: Here Reid Swanson & Matt Maclaurin

Configuring Hotspots

Web Site Development with HTML/JavaScrip

IN Development in Platform Ecosystems Lecture 2: HTML, CSS, JavaScript

Default Parameters and Shapes. Lecture 18

INTRODUCTION TO CSS. Mohammad Jawad Kadhim

CSS Selectors. Web Authoring and Design. Benjamin Kenwright

SCALABLE VECTOR GRAPHICS

What is the Box Model?

TypeScript. Types. CS144: Web Applications

So, if you receive data from a server, in JSON format, you can use it like any other JavaScript object.

HTML & CSS. Rupayan Neogy

Time series in html Canvas

Sample CS 142 Midterm Examination

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

EXPRESSIONS IN ANGULARJS

JavaScript CS 4640 Programming Languages for Web Applications

Leaflet Tips and Tricks

Tizen Web UI Technologies (Tizen Ver. 2.3)

CE419 Web Programming. Session 3: HTML (contd.), CSS

Web Programming HTML CSS JavaScript Step by step Exercises Hans-Petter Halvorsen

Programming by Delegation

Chapter 13 HTML5 Functions

Web Programming Pre-01A Web Programming Technologies. Aryo Pinandito, ST, M.MT

As we design and build out our HTML pages, there are some basics that we may follow for each page, site, and application.

What is CSS? NAME: INSERT OPENING GRAPHIC HERE:

JavaScript CS 4640 Programming Languages for Web Applications

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

CS1520 Recitation Week 2

A simple web templating system for TCL using C

Web Designing Course

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018)

CS 350 Internet Applications I Name: Exam II (CSS) October 29, 2013

Introduction D3 tutorial Part I

Client vs Server Scripting

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

Web Information System Design No.4 Put Style to Web Documents. Tatsuya Hagino

grabattention The jquery Plug-in

Data Visualization (CIS/DSC 468)

Transcription:

IAT 355 : Lab 01 Web Basics

Overview HTML CSS Javascript HTML & Graphics

HTML - the language for the content of a webpage <!DOCTYPE html> <html> <head> <title>a Web Page</title> <style> put css rules here </style> <script> javascript code goes here </script> </head> <body> content of the html page </body> </html> example

HTML (contd) There are several HTML elements, each for a different purpose. For example <a> can be used to create links <p> for paragraphs <div> for grouping other elements in a block Each element can have multiple attributes, which have predefined function <div id= block1 class= block > </div> // example: 01.html

CSS - for styling the content of a webpage CSS consists of rules. Each rule contains a selector for selecting elements on a webpage and corresponding rules. Here is an example that adds a margin of 100px to all div elements on the page div { margin-left: 100px; } Here is another that adds a background to all elements with class block.block{ background: #cdcdcd; } // example: 02.html

Javascript - for run-time processing in a webpage Javascript is a programming language that allows the programmer to manipulate the content of a webpage. Here is what it looks like <script> </script> console.log( Hello World ); //similar to println( Hello World ) in processing

Externalizing CSS and JS You can store the css and js code in separate files than the html files. To do that, you write files with extensions.css and.js for CSS and JS code respectively. Use the <head> section to include external files. To include css: <link rel="stylesheet" href="04.css" type="text/css"> To include js: <script type="text/javascript" src="04.js"> </script> example: 04.html

Javascript: Crash Course

Variable Declaration and Type var x = 100; //var is optional but can affect scope x = Ryan ; //this is NOT an error unlike Java/Processing Comments Use ample of comments using // (single line comment) /*... */ (multi-line comment) Objects //in Processing you do int x = 100; OR String x = Hello ; Property Property Value var myobj = {name: Ryan, age: 21, city: Vancouver } 9

Concatenation vs Addition 5 + 5 //10 5 + 5 // 55 Functions function myfunction(arg1, arg2) { } console.log(arg1); console.log(arg2); myfunction() //undefined, undefined myfunction( a ) //a, undefined myfunction( a, b ) //a, b 10

Variable Scope & use of var function f(){ var myvar = 10; //myvar is local myvar = 100; //myvar is STILL local } function f(){ myvar = 10; //myvar is global } Creating Objects using Prototypes //Javascript function Person(name, age){ this.name = name; this.age = age; } var myperson = new Person( Ryan, 21); myperson.name //Ryan //Processing class Person{ private String name; private int age; public Person(String name, int age){ this.name = name; this.age = age; } } 11

More Javascript objects Properties aka fields can be added to objects are runtime, unlike Processing. var myobj = new Person( Ryan, 21); // {name: Ryan, age: 21} myobj.location = Vancouver ; // {name: Ryan, age: 21, location: Vancouver } You can even add new functions in the object myobj.printname = function(){console.log(this.name;)} 12

HTML & SVG

SVG & HTML You can create SVG on a webpage, just like any other HTML element. To create a SVG, you use the svg tag. <svg> </svg> content of the svg 14

SVG Syntax The <svg> tag: <body> <svg> <!-- Include SVG elements here --> </svg> <body> 15

An SVG Example <svg width="500" height="500"> <circle cx="100" cy="100" r="80" /> <rect x="100" y="100" width="160" height="160" /> </svg> 16

SVG Elements Some of the common graphics elements include: <circle> <ellipse> <image> <line> <polygon> <polyline> <rect> <text> A More Complete Reference https://developer.mozilla.org/en-us/docs/web/svg/element 17

An SVG Example with some color <svg width="500" height="500"> <circle cx="100" cy="100" r="80" fill="red"/> <rect x="100" y="100" width="160" height="160" /> </svg> 18

Styling with some CSS //css circle { fill: red;} //html <svg width="500" height="500"> <circle cx="100" cy="100" r="80"/> <rect x="100" y="100" width="160" height="160" /> </svg> 19

You can event add ID & classes //css #mysquare{ fill: green }.red { fill:red } //html <svg width="500" height="500"> <rect x="20" y="20" width="160" height="160" class="red"/> <rect x="100" y="100" width="160" height="160" id="mysquare"/> </svg> example: 05.html 20

Creating SVG using d3.js d3.js is a Javascript library collection of helper classes and functions to manipulate webpages, based on data. Hence the name, d3 (data-driven documents). You can even use it to manipulate the page without any data. We can use d3 to create visualizations!

Using D3 1. Download the core library by clicking this link: https://github.com/d3/d3/releases/download/v4.4.1/d3.zip 2. Extract the zip file 3. Copy d3.js in the same directory as the html file. 4. Repeat steps 1-3 for any micro-libraries (for d3 v4.x only) 5. In the head of the html, include the file <script type="text/javascript" src="d3.js"> </script>

Recreate the squares using d3 First create the svg container element var svg = d3.select("body").append("svg").attr("width", 500).attr("height", 500); Adding the red rectangle svg.append("rect").attrs({ x: 20, y: 20, width: 160, height: 160, class: "red" }) 23

Recreate the squares using d3 (contd.) Add the green rectangle svg.append("rect").attrs({ x: 100, y: 100, width: 160, height: 160, id: "mysquare" }) example: 06.html 24