{
const showH4= Inputs.toggle({label: "Reverse Y Axis", value: true})
const showGraph = vl.selectSingle()
.name('showGraph')
.fields('toggle')
.init({ toggle: true })
.bind({
input: 'checkbox',
label: 'Show Graph'
});
const lineChartH4 = vl.markLine(
{clip: true, color: "black"})
.data(h4counts)
.encode(
vl.x().fieldQ('year').scale({domain: [860, 2100]}),
vl.y().fieldQ('H4_counts').scale({reverse: showH4})
);
const lineChartH5 = vl.markLine(
{clip: true, color: "red"})
.data(h5counts)
.encode(
vl.x().fieldQ('year').scale({domain: [860, 2100]}),
vl.y().fieldQ('H5_counts')
);
const lineChartH6 = vl.markLine(
{clip: true, color: "blue"})
.data(h6counts)
.encode(
vl.x().fieldQ('year').scale({domain: [860, 2100]}),
vl.y().fieldQ('H6_counts')
);
const lineChartL5 = vl.markLine(
{clip: true, color: "green"})
.data(l5counts)
.encode(
vl.x().fieldQ('year').scale({domain: [860, 2100]}),
vl.y().fieldQ('L5_counts')
);
const lineChartL6 = vl.markLine(
{clip: true, color: "pink"})
.data(l6counts)
.encode(
vl.x().fieldQ('year').scale({domain: [860, 2100]}),
vl.y().fieldQ('L6_counts')
);
return vl.layer(lineChartH4, lineChartH5, lineChartH6, lineChartL5, lineChartL6)
.title("Distribution of Number of Landings")
.width(400)
.height(250)
.config({
selection: {
showGraph: showGraph
}
})
.render();
}