Published
Edited
Feb 12, 2021
Fork of Week 3 - 2
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
// single-value selection over [Major_Genre, MPAA_Rating] pairs
// use specific hard-wired values as the initial selected values
const selection = vl.selectSingle('Select')
.fields('Major_Genre', 'MPAA_Rating')
.init({Major_Genre: 'Drama', MPAA_Rating: 'R'})
.bind({Major_Genre: vl.menu(genres), MPAA_Rating: vl.radio(mpaa)});
const filter = vl.filter(selection);

const unselected = vl.markCircle({opacity: 0.05})
.select(selection)
.transform(vl.not(filter));

const selected = vl.markCircle({opacity: 0.75})
.transform(filter)
.encode(vl.tooltip().fieldN('Title'))

return vl.data(movies)
.layer(unselected, selected)
.encode(
vl.x().fieldQ('Rotten_Tomatoes_Rating'),
vl.y().fieldQ('IMDB_Rating')
)
.render();
}
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