render({
mark: { type: "line", point: true },
data: { values: portfolioData },
transform: [
{ calculate: "datum.Shares * datum.Price", as: "Total Value" }
],
params: [{
name: "company_select",
select: {"type": "point", "fields": ["Company"]},
bind: "legend"
}],
encoding: {
x: { field: "Date", type: "T" },
y: { aggregate: "sum", field: "Total Value", type: "Q" },
color: { field: "Company", type: "N" },
column: { field: "Investor", type: "N" },
tooltip: [
{ field: "Date", type: "T" },
{ field: "Company", type: "N" },
{ aggregate: "sum", field: "Total Value", type: "Q" }
],
opacity: {
"condition": {"param": "company_select", "value": 1},
"value": 0.0
}
},
width: 100,
height: 200
})