Web Programming for Visualization

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

Today CSS HTML A project.
Presenter: James Huang Date: Sept. 26,  Introduction  Basics  Lists  Links  Forms  CSS 2.
Making Things Look Nice: Visual Appearance and CSS CMPT 281.
A really fairly simple guide to: mobile browser-based application development (part 1) Chris Greenhalgh G54UBI / Chris Greenhalgh
Today’s objectives Site performance Padding, Margins, Borders
Bartosz Kowalski Software Developer CERN. Presentation outline -HTML : introduction and history -HTML5 : -History and philosophy -New features -Structure.
4.01 Cascading Style Sheets
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
Chapter 4 Dreamweaver: Part II The Web Warrior Guide to Web Design Technologies.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
Building a UI with Zen Pat McGibbon –Sales Engineer.
INTERNAL CSS Casey Ames Different types of CSS There are three different types of CSS: ◦ External CSS ◦ Internal CSS ◦ Inline CSS In this presentation.
Images (1) Three most popular formats – Graphics Interchange Format (GIF) – Joint Photographic Experts Group (JPEG) – Portable Network Graphics (PNG) –
Styling and theming Build campaigns in style. What we'll look at... How a web document is structured How HTML and CSS fit together Tools you will need.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
CSS My favourite ICT lesson By Federico Boschi Cascading Style Sheets.
Form Tag How to use Form Tag Something NEW ? PARAMETER Attribute NAME Specifies the name for a form To specify which form to submit with JavaScript, this.
HTML CSS JAVASCRIPT. HTML - Stands for Hyper Text Markup Language HTML is a ‘language’ that describes web pages. This language is a collection of codes.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
WRT235: Writing in Electronic Environments Basic CSS.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
Cs332a_chapt10.ppt CS332A Advanced HTML Programming DHTML Dynamic Hypertext Markup Language A term describing a series of technologies Not a stand-a-lone.
DHTML. What is it? Dynamic HTML. Not a standard unlike HTML or Java It is a term applied by both Netscape and Microsoft to a collection of technologies.
1 © Netskills Quality Internet Training, University of Newcastle Using Style Sheets in Dreamweaver CS © Netskills, Quality Internet Training, University.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
Introduction to CSS. Why CSS? CSS Provides Efficiency in Design and Updates CSS relatively easy to use Can give you more flexibility and control Faster.
LAB 03: VISUALIZATION WITH D3 September 30, 2015 SDS 235 Visual Analytics.
CSS Fun damentals The Document Hierarchy Element Relationships The Box Model.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  CSS properties for margin  CSS properties for dimensions (width,
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
Data Visualization Fall What D3 is? Fall 2015Data Visualization2 JavaScript library for manipulating documents based on data Data-Driven Documents.
Web Technologies Lecture 8 JQuery. “A fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax.
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations SlideSet #5: Advanced CSS.
(1) HTML5, CSS, Twitter Bootstrap. (2) HTML5 Will be the new standard New features Drag and Drop and Support for local storage,,,, New input types Removed.
CSS FOUNDATIONS IN-DEPTH The nitty-gritty of css...
LT: I can use CSS to decorate a web page. Do Now: Get your storyboard, and log in to winhome. Write our a list of colors you want in your website. (Minimum.
CSCI 3100 Tutorial 2 Web Development Tools 1 HTML 5 & CSS 3 1.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
CSCI 3100 Tutorial 5 JavaScript & Ajax Jichuan Zeng Department of Computer Science and Engineering The Chinese University of Hong.
Introduction to Web Programming for Visualization
Working with Cascading Style Sheets
Web Basics: HTML/CSS/JavaScript What are they?
Objective % Select and utilize tools to design and develop websites.
SVG & DOM Manipulation via Javascript
Lab 03: Visualization with d3
Web Development & Design Foundations with HTML5 8th Edition
Inserting and Working with Images
Web Languages What Is a Web Page?
W3C Web standards and Recommendations
Objective % Select and utilize tools to design and develop websites.
Revision.
Prepared for Md. Zakir Hossain Lecturer, CSE, DUET Prepared by Miton Chandra Datta
Intro to Virtual and Web Mapping
Introduction to Internet Programming
Web Languages What Is a Web Page?
Lab 04: Interactive Visualization W/ d3
Introduction to D3.js and Bar Chart in D3.js
DHTML Javascript Internet Technology.
HTML A brief introduction HTML.
Parallel Coordinates and Scatter Plots
DHTML Javascript Internet Technology.
D3.js Tutorial (Hands on Session)
Cascading Style Sheets™ (CSS)
Secure Web Programming
D3.js Tutorial (Hands on Session)
Presentation transcript:

Web Programming for Visualization 赖楚凡 北京大学可视化与可视分析实验室 2017.10.25

Visualization

Visualization Programming Tools Framework Platform Url OpenGL with glut C/C++ http://nehe.gamedev.net/tutorial/lessons_01__05/22004/ OpenFramework http://www.openframeworks.cc/ Java2D with Swing Java http://download.oracle.com/javase/tutorial/2d/index.html Prefuse http://prefuse.org Processing Processing (based on Java) http://processing.org ProtoVis JavaScript http://protovis.org But now We recommend Web Programming and D3js Library

Overview Web Programming Web-Based Visualizations HTML CSS Javascript D3.js Others

Web Programming

Why Web Programing? Pros But Accessible Flexible Library and sharing Everyone, everywhere Flexible Easy to learn and develop Library and sharing Don’t need to build wheels for the cars But We still need C++ for high- performance computing and visualization

What is Web Programing? The WWW Stuffs HTML CSS JavaScript The House Style Designer JavaScript Builder

HTML HyperText Markup Language

HTML Structure An example Tags Annotation & Debug Header Body Embedded assets An example Tags <div></div>, <p></p>, <img/>, etc. Annotation & Debug

HTML Document Object Model (DOM) Tree Property Method Event Class, id, color … Method Find, insert … Event Onclick, onload …

HTML Learn online From HTML to HTML 5 W3school (上海赢科) W3Cschool (W3C中国) 菜鸟教程 (Runoob) From HTML to HTML 5

CSS CSS Inline or External Cascading Style Sheet (层叠样式表) Describe the look and formatting of HTML Inline or External Separate styling from structure

CSS CSS Selector Other styles and selectors From CSS to CSS 3 Less.js Select HTML elements ID Selector & Class Selector Other styles and selectors From CSS to CSS 3 Less.js Lesscss.cn

JavaScript Why JavaScript? Example Scenario HTML: contents CSS: styling JavaScript: behaviors and interactions Example Scenario Web Page (Client Side) Web Engine (Server Side) request response

JavaScript Inline vs External Manipulate elements

Others Framework Styling Library NodeJS, React, Backbone, etc. Bootstrap, JqueryUI, etc Library Jquery, Underscore, etc.

D3 for Visualization

Web-Based Visualization Bridge between HTML and visualization Canvas WebGL SVG D3.JS Canvas SVG

SVG vs Canvas Scalable Vector Graphics (SVG) Canvas Object-based vector graphics Immune to scaling Canvas Pixel-based graphics Fast to response, high performance

SVG-Based Visualization D3.js Data-Driven Documents http://d3js.org Binding data to HTML elements

The ‘Three Little Circle’ Step 1: Relationship between SVG and D3 http://bost.ocks.org/mike/circles/

The ‘Three Little Circle’ Step 2: Selection

The ‘Three Little Circle’ Step 3: Binding Data

D3 Core: Binding Data Enter – Update - Exit

Constructing a Scatterplot X-axis Y-axis X, Y mapping Color encoding Labeling Any interactions

Step 1: Loading the data Loading Data Preprocessing related attributes d3.tsv("data.tsv", function(error, data) { if (error) throw error; data.forEach(function(d) { d.sepalLength = +d.sepalLength; d.sepalWidth = +d.sepalWidth; });

Step 2: Mapping the data Mapping the data Defining the boundary Defining the ‘d3.scale’ Choosing the mapping mechanism – linear, log, etc. Setting the ‘domain’ and ‘range’ var margin = {top: 20, right: 20, bottom: 30, left: 40}, width = 960 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; var x = d3.scale.linear() .range([0, width]); var y = d3.scale.linear() .range([height, 0]); x.domain(d3.extent(data, function(d) { return d.sepalWidth; })).nice(); y.domain(d3.extent(data, function(d) { return d.sepalLength; })).nice();

Step 3: Preparing for drawing var svg = d3.select("body").append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); var xAxis = d3.svg.axis() .scale(x) .orient("bottom"); var yAxis = d3.svg.axis() .scale(y) .orient("left"); SVG is the main canvas for drawing X-axis and Y-axis is mapping with the x and y scale

Step 4: Drawing the primitives Drawing the xAxis Drawing the labels Drawing the yAxis and lables svg.append("g") .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis) .append("text") .attr("class", "label") .attr("x", width) .attr("y", -6) .style("text-anchor", "end") .text("Sepal Width (cm)"); .attr("class", "y axis") .call(yAxis) .attr("transform", "rotate(-90)") .attr("y", 6) .attr("dy", ".71em") .text("Sepal Length (cm)")

Step 5: Drawing the Dot Main parts of the drawing Data binding Data entering Data updating svg.selectAll(".dot") .data(data) .enter().append("circle") .attr("class", "dot") .attr("r", 3.5) .attr("cx", function(d) { return x(d.sepalWidth); }) .attr("cy", function(d) { return y(d.sepalLength); }) .style("fill", function(d) { return color(d.species); });

Step 6: Drawing the Legends Labels are the data of categories, in this data is 3 categories Adding the rect and text Setting the contents var legend = svg.selectAll(".legend") .data(color.domain()) .enter().append("g") .attr("class", "legend") .attr("transform", function(d, i) { return "translate(0," + i * 20 + ")"; }); legend.append("rect") .attr("x", width - 18) .attr("width", 18) .attr("height", 18) .style("fill", color); legend.append("text") .attr("x", width - 24) .attr("y", 9) .attr("dy", ".35em") .style("text-anchor", "end") .text(function(d) { return d; });

Practice Draw a Parallel Coordinates Plot (PCP) Iris Data: 150 items, 4 dimensions

Canvas Canvas rendering WebGL Based on OpenGL ES and Canvas