Shirley Wu
Coming from React:
Data Visualization
for React Developers
↓
Intro to D3
↓
Building Custom
Data Visualizations
From elsewhere:
Intro to D3
↓
Building Custom
Data Visualizations
↓
(maybe)
Data Visualization
for React Developers
custom data visualizations can be categorized into two broad categories:
- static dataset
- explore data for story
- communicate story to audience
- dynamic dataset
- interview stakeholders
- build tool for stakeholders to explore the data
examples:
New York Times, The Pudding, The Washington Post, etc.
examples:
scientific visualizations, internal business tools at Netflix, Uber, Airbnb, etc.
Data: top 10 blockbusters every year for the last two decades
Goal: come up with a design and implement it together
(Yay participation!)
Data exploration
with Observables
and Vega-Lite
↓
Design with
and Gestalt Laws
↓
Code with
and D3 shapes, layouts
↓
Finish with
To load external libraries: | d3 = require('d3') |
To write text: | md ` ... ` |
To set global variable: | globalVar = ... |
To write a block of javascript code: | { ... } |
To create an SVG element: | { const svg = DOM.svg(width, height) ... return svg; } |
Bar chart
For categorical comparisons
Domain: categorical
Range: quantitative
Histogram
For categorical distributions
Domain: quantitative bins
Range: frequency of quantitative bin
Scatterplot
For correlation
2 categories, and the relationship between their quantitative values
Line chart
For temporal trends
Domain: temporal
Range: quantitative
A grammar of
interactive graphics
Brainstorm some charts
to answer the questions.
Map individual or
aggregate data
elements to marks.
Map data attributes
to channels.
Visualization Analysis and Design. Tamara Munzner, with illustrations by Eamonn Maguire. A K Peters Visualization Series, CRC Press, 2014.
Visualization Analysis and Design. Tamara Munzner, with illustrations by
Eamonn Maguire. A K Peters Visualization Series, CRC Press, 2014.
Quantitative
Categorical
Temporal
Visualization Analysis and Design. Tamara Munzner, with illustrations by
Eamonn Maguire. A K Peters Visualization Series, CRC Press, 2014.
mark
bar
channels
x: category
y: quant
mark
point
channels
x: quant
y: quant
mark
point
channels
x: quant
y: quant
color: category
mark
point
channels
x: quant
y: quant
color: category
size: quant
Visualization Analysis and Design. Tamara Munzner, with illustrations by
Eamonn Maguire. A K Peters Visualization Series, CRC Press, 2014.
One-to-one mapping of data to channel
Multiple mappings of channel to mark (x, y, size, color usually)
Do not EVER map multiple data attributes to the same channel
the human mind naturally
groups individual elements
into patterns
↓
use in data visualization to
save processing time
Proximity
Put related objects near each other
(The Functional Art, Ch. 6 by Alberto Cairo)
Similarity
Indicate like objects (helpful if they can't be placed close to each other)
(The Functional Art, Ch. 6 by Alberto Cairo)
Enclosure
Helpful when creating visualizations with multiple sections
(The Functional Art, Ch. 6 by Alberto Cairo)
"You don’t always need to start from scratch, remix what’s out there already"
- Nadieh Bremer
But make sure they're the right visuals to communicate your message!
Sketch all the things!
Break it down! What do you need to draw the marks? What do you need to calculate the channels?
To draw marks: SVG (or canvas)
To calculate channels: D3 scales, shapes, and layouts (or straight-up math!)
rect
x: x-coordinate of top-left
y: y-coordinate of top-left
width
height
circle
cx: x-coordinate of center
cy: y-coordinate of center
r: radius
text
x: x-coordinate
y: y-coordinate
dx: x-coordinate offset
dy: y-coordinate offset
text-anchor: horizontal text alignment
Hi!
path
d: path to follow
Moveto, Lineto, Curveto, Arcto
For translating raw data to what SVG needs to draw
Take output of layout calculations and draw SVG elements
Sometimes all you need are scales to get from data to screen space
Often times, you may need specific layouts.
These output x/y positions
And these generate path commands
Great dataviz-specific interactions
Implement the designs!
Each curve represents a movie
x: release date
y: box office relative to mean
Titles, descriptions, and legends
to explain the visualization
Axes and annotations
to describe the data
d3-legend by Susie Lu
d3-annotation by Susie Lu
Implement the designs!
Implement the designs!
D3:
hover, click, and
other simple interactions
D3 & React (or similar):
Process (at Netflix with Susie & Elijah):
Advice (from Netflix):
Advice, cont.:
Books:
The Functional Art by Alberto Cairo
Visual Analysis and Design by Tamara Munzner
Online:
The little of visualization design
Information is Beautiful Awards
Lisa Rost
Nadieh Bremer
Susie Lu
Elijah Meeks
Beta-testers
Kristin Henry
Micah Stubbs
Radames Ajna
Santhosh Soundararajan
Nathan Harris
Dylan Wootton