Platform
Solutions
Resources
Pricing
Sign in
Sign up
Interactive Info Vis
UW iSchool Course INFO 474: focused on designing and building visualizations to better understand and communicate about pressing issues.
Workspace
Fork
Published
In Class
By
Mike Freeman
Edited
Nov 9, 2020
Fork of
D3 Small Multiples
3 stars
In Class
Observable Basics
Foundations Practice
Data Basics: Loading + Manipulating
D3 Activity 1
D3 Activity 1 (complete)
D3 Activity II
D3 Activity II (complete)
Graphical Encodings Design Exercise
Visual Cognition
Visual Cognition Complete
Treemap Activity
Treemap Activity (complete)
D3 Chart Review
D3 Chart Review (complete)
Election Map (complete)
Election Map
D3 Small Multiples
D3 Small Multiples (complete)
Interaction Techniques
Interaction Techniques (complete)
Scroll Starter
Scrolling (complete)
generative-art
(3)
Insert cell
Insert cell
Insert cell
import
{
select
}
from
"@jashkenas/inputs"
Insert cell
viewof
metric
=
select
(
[
"type"
,
"degree_length"
]
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
by_type_chart
=
{
const
div
=
d3
.
create
(
"div"
)
;
const
charts
=
div
.
selectAll
(
"div"
)
.
data
(
by_type_data
)
// this will have only 4 elements in it
.
join
(
"div"
)
.
style
(
"height"
,
chart_height
+
"px"
)
.
style
(
"width"
,
chart_width
+
"px"
)
.
attr
(
"class"
,
"chart-container"
)
.
call
(
drawChart
)
;
return
div
.
node
(
)
;
}
Insert cell
Insert cell
chart_height
=
300
Insert cell
chart_width
=
400
Insert cell
x
=
d3
.
scaleLinear
(
)
.
domain
(
d3
.
extent
(
chart_data
,
d
=>
d
.
x
)
)
.
range
(
[
margin
.
left
,
chart_width
-
margin
.
right
]
)
Insert cell
y
=
d3
.
scaleLinear
(
)
.
domain
(
d3
.
extent
(
chart_data
,
d
=>
d
.
y
)
)
.
range
(
[
chart_height
-
margin
.
bottom
,
margin
.
top
]
)
Insert cell
Insert cell
tickFormatter
=
d3
.
format
(
"$.2s"
)
Insert cell
xAxis
=
g
=>
g
.
attr
(
"transform"
,
`translate(0,${
chart_height
-
margin
.
bottom
})`
)
.
call
(
d3
.
axisBottom
(
x
)
.
tickFormat
(
tickFormatter
)
)
Insert cell
yAxis
=
g
=>
g
.
attr
(
"transform"
,
`translate(${
margin
.
left
},0)`
)
.
call
(
d3
.
axisLeft
(
y
)
.
tickFormat
(
tickFormatter
)
)
Insert cell
xLabel
=
ele
=>
ele
.
text
(
"In State Tuition"
)
.
attr
(
"x"
,
(
x
.
range
(
)
[
1
]
-
x
.
range
(
)
[
0
]
)
/
2
)
.
attr
(
"y"
,
chart_height
-
margin
.
bottom
+
35
)
.
style
(
'font-family'
,
"sans-serif"
)
.
style
(
"font-size"
,
'14px'
)
Insert cell
chartTitle
=
ele
=>
ele
.
text
(
d
=>
d
[
0
]
)
// here is the other (corresponding) tricky part!
.
attr
(
"transform"
,
`translate(${
chart_width
/
2
}, ${
20
})`
)
.
style
(
"text-anchor"
,
"middle"
)
.
style
(
'font-family'
,
"sans-serif"
)
Insert cell
yLabel
=
ele
=>
ele
.
text
(
"Out of State Tuition"
)
.
attr
(
"transform"
,
`translate(${
margin
.
left
-
40
}, ${
chart_height
/
2
})rotate(-90)`
)
.
style
(
"text-anchor"
,
"middle"
)
.
style
(
'font-family'
,
"sans-serif"
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html
`<style>
.chart-container {
display:inline-block;
}
</style>`
Insert cell
One platform
to build and deploy the best data apps
Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
metric
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart_data
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
drawChart
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
drawPoint
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
by_type_data
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
by_type_chart
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
scales
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart_height
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart_width
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
x
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
y
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
axes
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
tickFormatter
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
xAxis
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
yAxis
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
xLabel
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chartTitle
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
yLabel
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
appendix
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
margin
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML