Lecture 4: Tableau, D3
DS 4200 FALL 2020
- Prof. Cody Dunne
NORTHEASTERN UNIVERSITY
1
Slides and inspiration from Michelle Borkin, Krzysztof Gajos, Hanspeter Pfister, Miriah Meyer, Jonathan Schwabish, and David Sprague
Lecture 4: Tableau, D3 DS 4200 F ALL 2020 Prof. Cody Dunne N - - PowerPoint PPT Presentation
Lecture 4: Tableau, D3 DS 4200 F ALL 2020 Prof. Cody Dunne N ORTHEASTERN U NIVERSITY Slides and inspiration from Michelle Borkin, Krzysztof Gajos, Hanspeter Pfister, 1 Miriah Meyer, Jonathan Schwabish, and David Sprague C HECK - IN 3 P
DS 4200 FALL 2020
NORTHEASTERN UNIVERSITY
1
Slides and inspiration from Michelle Borkin, Krzysztof Gajos, Hanspeter Pfister, Miriah Meyer, Jonathan Schwabish, and David Sprague
3
4
5
6
7
Slides and inspiration from Sara Di Bartolomeo
8
Final Project validation
✓ ✓ ✓ ✓
Final project follow-up
(Using the nested model via design study “lite” methodology) https://northeastern.instructure.com/courses/18721/pages/project-overview
9
In-class project pitches: M 2020-09-30 What questions do you have for me?
10
11
12
~25 min total
13
14
→ not a data visualization library (it’s not like plotly, not matplotlib, ...)
D3 is not a Data Visualization Library - Elijah Meeks
→ no out of the box charts (no functions to automatically build a chart)
Meeks, 2018
Meeks, 2018
that make up an image
you zoom in or distort the picture
too much
Minervini, 2017
❏
<svg> tag. E.g., <svg width='500' height='500'>
❏
can add <style> attributes
❏
Basic SVG shapes: rect, circle, line, text, polyline
❏
Can group elements using the <g> tag
svg = d3.select('body').append('svg') .attr('width', 200) .attr('height', 200) var circle = svg.append('circle') .attr('cx', 30) .attr('cy', 30) .attr('r', 20) .attr('fill', 'black')
Example: drawing
Selections: .select ('selectors’) .selectAll ('selectors’) .select('tagname') // select by name of the element .select('#id') // select by id of the element .select('.classname') // select by class name
More info on selections: https://bost.ocks.org/mike/selection/ Example: selections-GoT
Data can be added in a number of different ways Simplest way is through→ .data( ) The .data( ) method joins the current selection with entries in your dataset
Bostock, 2013
Bostock, 2013
Bostock, 2013
Bostock, 2013
If you ever get lost:
“How selections work:” https://bost.ocks.org/mike/selection/
Example: data_binding
// allows you to modify the html
// gives access to any CSS styles
// allows you to toggle classes on and off
// allows you to access any attributes
Example: selections-GoT
// Quantitative attributes
// Original values that you will modify
// Values that we want to scale our data to
Domain Range
// categorical attributes
// original values that you will modify
// Values that we want to scale our data to
// e.g., to control the spacing in between the bars