{
const slider = vl.selectInterval('selected_interval').encodings('x');
const weatherBarPlot = vl.markBar()
.title('Frequency of Weather Types in Seattle between 2012 and 2015')
.transform(vl.filter(slider))
.encode(
vl.x().count().scale({domain: [5, 750]}).title('Frequency of Days'),
vl.y().fieldN('weather').title('Weather Type'),
vl.color().fieldN('weather').scale({range: weatherColors})
);
const maxTempScatterPlot = vl.markCircle()
.title({
text: 'Seattle Daily Max Temperature',
subtitle: 'Click to Select a Weather | Double Click to Clear'
})
.params(slider)
.encode(
vl.x().fieldT('date').title('Date').scale({domain: ['2012/01/01', '2016/01/01']}),
vl.y().fieldQ('temp_max').title('Max Temperature').scale({domain: [-5, 40]}),
);
return vl.vconcat(maxTempScatterPlot, weatherBarPlot).data(seattleWeatherData).render();
}