vl.markBar()
.data(data)
.transform(
vl.calculate("if(datum.status === 200, 0, if(datum.status === '3xx', 1, 2))").as('statusorder'),
vl.calculate("if(datum.status === 200, 'Never Moved', if(datum.status === '3xx', 'Moved and Found', if(datum.status === '4xx', 'Not Found', ' ')))").as('Content Status')
)
.encode(
vl.x().fieldQ('qdel').bin({ extent: [0, 1.1], maxbins: 11 }).type("ordinal").axis({labelExpr: "substring(datum.value, 0, 1) == '1' ? '[100]' : substring(datum.value,2,3) == '9' ? '[90 - 100)' : substring(datum.value,6,7) == '1' ? '[0 - 10)' : '[' + substring(datum.value,2,3) + '0 - ' + substring(datum.value,8,9) + '0)'", labelAngle: -45}).title("Percent of queries per page with deleted terms (stop words removed)"),
vl.y().count().title("Page Count"),
vl.color().fieldN('Content Status').scale({
"domain": ["Never Moved", "Moved and Found", "Not Found", " "],
"range": ["#B2D8B2", "#FFE4B2", "#F59385", "#FFFFFF"]
}) .legend(
{orient: 'bottom-right', offset: 50, direction: 'horizontal', fillColor: '#ffffff', strokeColor: '#000000', padding: 6} ),
vl.order().fieldQ('statusorder').sort('ascending')
)
.width(400)
.height(200)
.config({ view: { stroke: null }})
.render()