Public
Edited
Jan 19, 2023
Insert cell
# CSE 442 2023 Wi - Interactions Exercises
Insert cell
Insert cell
Insert cell
viewof table1 = Inputs.table(checkouts_by_title_2021_3k)
Insert cell
Insert cell
viewof table = Inputs.table(checkouts_separate_subjects)
Insert cell
Insert cell
Insert cell
vl.markBar()
.data(checkouts_by_title_2021_3k)
.encode(
vl.x().fieldT('CheckoutMonth').timeUnit("month"),
vl.y().sum('Checkouts'),
vl.tooltip().sum('Checkouts')
)
.render()
Insert cell
vl.markPoint({filled: true, size: 50, opacity: 0.6})
.data(checkouts_by_title_2021_3k)
.encode(
vl.column().fieldN('UsageClass'),
vl.x().fieldT('PublicationYear').timeUnit('year'),
vl.y().sum('Checkouts'),
vl.tooltip().fieldT('PublicationYear').timeUnit('year')
)
.render()
Insert cell
vl.markArea()
.data(checkouts_by_title_2021_3k)
.encode(
vl.column().fieldN('UsageClass'),
vl.x().fieldT('PublicationYear').timeUnit('year'),
vl.y().sum('Checkouts'),
vl.tooltip().fieldT('PublicationYear').timeUnit('year')
)
.render()
Insert cell
Insert cell
vl.markBar()
.data(checkouts_separate_subjects)
.transform(
vl.groupby('Title')
.aggregate(vl.count('Subject').as('TotalSubjects'))
)
.encode(
vl.x().fieldQ('TotalSubjects'),
vl.y().count()
)
.render()


Insert cell
vl.markArea()
.data(checkouts_separate_subjects)
.transform(
vl.filter('datum.Subject == "Fiction" || datum.Subject == "Nonfiction"')
)
.encode(
vl.column().fieldN('Subject'),
vl.x().fieldT('PublicationYear').timeUnit('year'),
vl.y().sum('Checkouts')
)
.render()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more