render({
mark: "bar",
data: { values: portfolioData },
transform: [
{ calculate: "datum.Shares*datum.Price", as: "Total Value" }
],
encoding: {
x: { field: "Symbol", type: "N", axis: { title: "Symbol" } },
y: { field: "Total Value", type: "Q", axis: { title: "Total Value ($)" } },
color: { field: "Symbol", type: "N" },
column: { field: "Date", type: "T" },
row: { field: "Investor", type: "N" },
tooltip: [
{ field: "Symbol", type: "N" },
{ field: "Price", type: "Q", format: "$.2f" },
{ field: "Shares", type: "Q" },
{ field: "Total Value", type: "Q", format: "$.2f" }
]
},
width: 400,
height: 200,
config: {
view: { stroke: "transparent" },
axis: { grid: true }
}
})