Romain Vuillemot, LIRIS, École Centrale de Lyon/Département Math-Info, Website, Twitter.
Contact or questions: romain.vuillemot@ec-lyon.fr
Interactive Data Visualization for the Web by Scott Murray |
Other books
All homeworks/assignements/reports are due the day before the class at 23.59pm Lyon Time (GMT+1). Using this form.
Friday 10/01/2020 13:30-15:30
Overview: Class organization (slides)
Basics of Data Visualization: Perception, cognition, Visual mapping, Standard charts (slides)
Authoring visualizations: Libraries, Tools, Tableau Software (slides)
Introduction to D3.js (slides)
Final projects description (slides)
Friday 10/01/2020 15:45-17:45
Tableau Tutorial
Problem 1: Iris flowers visualization
iris.csv
and load it in Tableau; convert data types (if needed)Problem 2: Elections map
us-elections-history.csv
and load it in Tableau; convert data types (if needed)Year
as columns, State
as rows and State Winner
as color/marks.Latitude (generated)
et Longitude (generated)
, with State
as shapes and color ATTR([State Winner])
Problem 3: Stock markets visualizations
stocks.csv
and load it in Tableau; convert data types (if needed)Problem 4: Global Superstore Dataset
Global-Superstore-Orders-2016.xlsx
and load it in Tableau; join datasets (if needed)📅 For next class (17/01/2020)
✍ Assignments
PROJECT: Group proposal of 2 or 3 students
Submit a project topic (1-paragraph): what is the question you expect to answer? which data do you need? how do you plan to collect your data? what are the main risk in collecting/visualizing it? what are the privacy/ethical issues?
Create a GitHub account
📖 Readings and preparation
Read introductions to JavaScript, D3 and Git
Interactive Data Visualization for the Web Chapter 1. Introduction , Chapter 2. Introducing D3 and Chapter 3. Technology Fundamentals
Get familiar with JavaScript
Get familiar with GitHub
Friday 17/01/2020 13:30-15:30
<img src="img/chart-margin.png" height=50>
var margin = {top: 20, right: 10, bottom: 20, left: 10};
var width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
Assignment: draw a red rectangle (like the gray one above) in the center of the page (using margin
, width
and height
).
Bar chart | SVG |
<img src="img/bar-chart.png" height=50>
<rect>
x
and width
y
and height
fill
(style)d3.scaleLinear()
and categorical d3.scaleBand()
Assignment: build a bar chart with a random dataset
d3.range(n).map(Math.random)
x.bandwidth()
function generates the width
attribute for the <rect>
Line chart | SVG |
<img src="img/line-chart-path.png" width=400>
<path>
d3.line().x(function(d) { }).y(function(d) { })
to generate attribute d
fill
d3.line().curve(d3.curveCardinal)
d3.scaleLinear()
Assignment: build a line chart using a simple JSON temporal dataset add circles for each time point.
dataset.json
file in blockbuilder:
[{"id" : 1, "name": "A", "value": 10, "date": "2016-01"},
{"id" : 2, "name": "B", "value": 30, "date": "2016-02"},
{"id" : 3, "name": "C", "value": 20, "date": "2016-03"}
]
d3.json("dataset.json", function(error, data) {}
d3.timeParse("%Y-%m")
d3.scaleTime()
d3.timeFormat("%b %y")
Scatterplot | SVG |
<img src="img/scatterplot.png" width=400>
<circle>
cx
and cy
r
(radius) and d3.scaleSqrt()
fill
(style) and d3.scaleOrdinal(d3.schemeCategory20)
color scaleAssignment: build a scatterplot using the Iris dataset and load the chart using a function that takes the chart visual mapping and dimensions as input parameters.
iris.csv
d3.csv('iris.csv', function(error, data){}
Friday 17/01/2020 15:45-17:45
Axis | SVG
<img src="img/chart-axis.png" width=400>
var xAxis = d3.axisBottom()
.scale(x);
var yAxis = d3.axisLeft()
.scale(y);
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis)
Interaction
.on("click", function(d){})
.on("mouseover", function(d){})
and .on("mouseout", function(d) {})
d3.drag
, tooltip (example)Legends
color.domain()
to retrieve them)<g>
and then fill the rows with the mappings)Multiple views
Assignment: build a coordinated scatterplot matrix using the Iris dataset.
Submit the blockbuilder link to submit here at the end of the class (17h45)
📅 For next class (24/01/2020)
CODE: Extend the line chart using the stocks.csv
where each line is a different symbol (and a different color). BONUS: add a title, legend and interactivity (e.g. tooltip, show time points, etc.) submission form
READINGS: Chapter 4. Setup, Chapter 5. Data, Chapter 6. Drawing with Data, Chapter 7. Scales.
Friday 24/01/2020 13:30-15:30
Visualization of geo and temporal data
Introduction to data cleaning tools and methods
Advanced data visualization concepts: Animation, Interaction, Multiple Views (slides)
Solution for interactive scatterplot matrix and legend and multiple line-chart. How would you improve this chart? by adding brushing interactions, including legends in diagonal and distribution in diagonal.
Solution for stocks line chart. How would you improve this chart?
Advanced D3 layouts (slides)
Friday 24/01/2020 15:45-17:45
d3.nest
{symbol: "MSFT", date: Sat Jan 01 2000 00:00:00 GMT+0100 (CET), price: 39.81}
{symbol: "MSFT", date: Tue Feb 01 2000 00:00:00 GMT+0100 (CET), price: 36.35}
{symbol: "MSFT", date: Wed Mar 01 2000 00:00:00 GMT+0100 (CET), price: 43.22}
Assignment: Nest stocks by symbol and calculate aggregated values (max/min/sum) over price; parse dates.
Expected result:
0: {key: "MSFT", values: Array(123), maxPrice: 43.22, sumPrice: 3042.6}
1: {key: "AMZN", values: Array(123), maxPrice: 135.91, sumPrice: 5902.4}
2: {key: "IBM", values: Array(123), maxPrice: 130.32, sumPrice: 11225.13}
Grouped bar chart |
<img src="img/grouped-bar-chart.png" width=400>
d3.nest
<rec>
d3.scaleBand()
fill
Assignment: build a grouped bar chart using the stocks.csv
.
Start using random data
var n = 10, // number of samples
m = 5; // number of series
var data = d3.range(m).map(function() {
return d3.range(n).map(Math.random);
});
Stacked bar chart |
<img src="img/stacked-bar-chart.png" width=400>
d3.stack
<rec>
d3.scaleBand()
fill
d3.scaleLinear()
Assignment: build a stacked bar chart using the stocks.csv
.
year
d.date.getFullYear()
symbol
d3.stack
layout0: {MSFT: 356.07999999999987, AMZN: 527.17, IBM: 1162.97, AAPL: 260.98, year: "2000"}
1: {MSFT: 304.17, AMZN: 140.87, IBM: 1163.6200000000001, AAPL: 122.11000000000003, year: "2001"}
2: {MSFT: 261.92, AMZN: 200.68, IBM: 901.4999999999999, AAPL: 112.89999999999998, year: "2002"}
d3.stack()
layout using the list of unique symbols as keys
and the flat dataset as dataAnimated transitions
.transition(duration)
, and .delay(duration)
radio
buttonAssignment (BONUS): build an animated transition between grouped bar chart and stacked bar chart.
grouped
and stack
<div>
<label><input type="radio" name="mode" value="grouped" checked>Grouped</label>
<label><input type="radio" name="mode" value="stacked">Stacked</label>
</div>
d3.selectAll("input").on("change", function() {})
📅 For next class (31/01/2020)
Write a document for your project data cleaning and preparation: data source, data shaping, processing, etc. If you use external tools (e.g. Excel, DataWrangler, Tableau) add some details of the role and steps performed using those.
Load a clean data sample using d3 and descriptive charts (histogram, scatterplot, ..) in a wepage showing the characteristics of the dataset: distribution, statistics, trends, etc. Add this link to your analysis in the class document (the page should be hosted on GitHub).
Draw a mockup of your project using pen and paper and add this link to the class document (the page should be hosted on GitHub).
Read principles of the Five design sheets methodology
Reading: Chapter 8. Axes, Chapter 9. Updates, Transitions, and Motion , Chapter 10. Interactivity, Chapter 11. Layouts.
Friday 31/01/2020 13:30-15:30
Design and case studies in visualization (slides)
Introduction to Sketching, Rapid Prototyping, Development cycles (slides) and using the Five Design Sheet methodology
Friday 31/01/2020 15:45-17:45
Apply the 5DS to your project (paper and pen!)
Project setup using modern web development tools: local server, package managers (slides)
Geo-Map | Example
<img src="img/geo-map.png" width=400>
<path>
+ d3.geoPath()
d3.geoPath()
fill
(style)Assignment: build a geo-map following those instructions.
At the end of the tutorial:
📅 For next class (07/02/2020)
✍ Assignments
Friday 07/02/2020 13:30-15:30
Node-Link Graph | Example |
<img src="img/node-link.png" height=100>
<circle>
d3.forceSimulation()
fill
(style)Assignment: starting with this Node link diagram that is based on force layout with different layouts: random, radial, line, line by category and encodings: color, size.
d3.forceSimulation
documentationFriday 07/02/2020 15:45-17:45
Friday 14/02/2020 13:30-15:30
Peer-review of other groups projects
Pre-Requirements:
Peer-review:
Friday 14/02/2020 15:45-17:45
You may also add the following header to your project:
<!DOCTYPE html>
<html lang="en">
<head>
<title>YOUR_TITLE</title>
<meta name="description" content="Your Description">
<meta name="author" content="Authors">
<meta property="og:title" content="Your Title">
<meta property="og:description" content="Your Description">
<meta property="og:image" content="https://theo-jaunet.github.io/MemoryReduction/assets/thumbnail.png">
...
</head>
In the class document:
Friday 21/03/2020 13:30-17:45
Each group has a 15min time slot (10min presentation, 5min questions) to present their project.
No slide: just show the visualization and tell a convincing story (e.g. don’t list features, etc.). Should address the following:
Add a README.md
file in the repository organized as follows:
IMPORTANT – Regarding the dataset
As a general rule keep in mind the projects will be made public so anybody should be able to understand on their own and privacy of the datasets should be preserved.
Friday 28/02/2020 13:30-15:30
Friday 28/03/2020 15:45-17:45
Final project is due
Wednesday 11/02/2020
Tableau Software
D3.js
SVG
Git/GitHub
JavaScript
Data Visualization Classes
Blogs
Books
Graphics/Journals
Color
Misc