vl
.data(filtered_data)
.title('Volatility')
.encode(
vl
.x()
.type('temporal')
.field('Date')
.axis({
title: "Time",
format: "%m/%d/%y"
}),
vl
.y()
.type('quantitative')
.scale({ zero: false, type: 'log' })
.axis({
title: "Closing Price ($)"
}),
vl
.color()
.condition({
test: "datum.Open < datum.Close",
value: "#06982d"
})
.value("#ae1325"),
vl.tooltip([
{ field: "Symbol", type: "ordinal", title: "Symbol" },
{ field: "Date", type: "temporal", title: "Date" },
{ field: "Close", type: "quantitative", title: "Close", format: ".0f" },
{ field: "Close", type: "quantitative", title: "Close", format: ".0f" },
{ field: "Open", type: "quantitative", title: "Open", format: ".0f" },
{ field: "High", type: "quantitative", title: "High", format: ".0f" },
{ field: "Low", type: "quantitative", title: "Low", format: ".0f" }
])
)
.layer(
vl
.markBar()
.select(vl.selectInterval().bind('scales'))
.encode(vl.y().field('Open'), vl.y2().field('Close')),
vl.markRule().encode(vl.y().field('Low'), vl.y2().field('High'))
)
.width(700)
.height(400)
.render()