graph = vl
.markBar()
.title("Deaths registered per week in England and Wales")
.data(mapped.concat(historical))
.width({ step: 2 })
.encode(
vl.x().fieldO("year").axis(false),
vl
.y()
.sum("deaths")
.title("Deaths registered per week")
.axis({ grid: false }),
vl.column().fieldO("week").title("Week").spacing(0),
vl
.color()
.field("year")
.title("Year")
.scale({
range: [
"#aaa",
"#aaa",
"#aaa",
"#aaa",
"#aaa",
"#aaa",
"#aaa",
"#aaa",
"#aaa",
"#aaa",
"#f75123",
"#4a88f1",
"#51a723",
"#f7a723",
"#000000"
]
})
.legend({ orient: "bottom" }),
vl.tooltip([
{ field: "week", type: "nominal" },
{ field: "year", type: "nominal" },
{ field: "deaths", type: "quantitative" }
])
)