Published
Edited
Jun 28, 2020
Insert cell
Insert cell
{
const click = vl.selectSingle().empty('none'); // empty selection matches no points

const plot1 = vl.markPoint()
.encode(
vl.x().fieldT('date'),
vl.y().fieldQ('age'),
vl.tooltip(['name', 'age', 'description']),
)
.width(width)
.select(click)
const plot2 = vl.markImage()
.encode(
vl.y().fieldT('date'),
vl.x().fieldQ('age'),
vl.url().fieldN('image'),
)
.width(width)
.transform(vl.filter(click));
return vl.vconcat(plot1, plot2)
.data(data)
.autosize({type: 'fit-x', contains: 'padding'})
.render();
}
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