vl.markBar()
.data(dat)
.encode(
vl.x().fieldQ("count"),
vl.y().fieldN("task").sort(vl.fieldQ('count').order('descending')).axis({titleAngle:0, titleAnchor:"start", titleAlign:"center", titlePadding:20, titleX:-20, labelFontSize:12}),
vl.row().fieldN("goal").sort(["View unavailable page","View change over time","Investigate misinformation/hacking","Other"]).header({labelAngle:0, title:null, labelAnchor:"start", labelOrient:"top", labelPadding:-20, labelFontStyle:"bold", labelFontSize:14, labelExpr:"replace(datum.value, /^(.)/, 'Goal: $1')"}),
vl.color().fieldN("goal").legend(null)
)
.resolve( {
"scale": {"y": "independent"}
})
.title({text:"Web Archives User Tasks of Journalists",fontSize:20, subtitle:" "})
.render()