vl.layer(
vl.markRule({color: "black", strokeDash: [2,2], opacity: 0.7})
.data([{zero: 0}])
.encode(vl.y().fieldQ("zero")),
vl.markLine({strokeWidth: 2})
.data(percentChangeCombined)
.encode(
vl.x().fieldO("DIM_TIME").title("Year"),
vl.y().fieldQ("pct_change")
.scale({zero: true})
.title("Percentage Change from Previous Year (%)"),
vl.color().fieldN("indicator").title("Health Indicator"),
vl.tooltip([
{field: "DIM_TIME", type: "ordinal", title: "Year"},
{field: "pct_change", type: "quantitative", title: "% Change", format: ".2f"},
{field: "indicator", type: "nominal", title: "Indicator"}
])
),
vl.markPoint({size: 60, filled: true})
.data(percentChangeCombined)
.encode(
vl.x().fieldO("DIM_TIME"),
vl.y().fieldQ("pct_change"),
vl.color().fieldN("indicator"),
vl.tooltip([
{field: "DIM_TIME", type: "ordinal", title: "Year"},
{field: "pct_change", type: "quantitative", title: "% Change", format: ".2f"},
{field: "indicator", type: "nominal", title: "Indicator"}
])
)
)
.width(600)
.height(400)
.render()