Public
Edited
Oct 7, 2023
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 1000,
title: "Asset Allocation - %",
y: {
grid: true
},
x: { label: "Date", tickFormat: " " },
marks: [
Plot.ruleY([65], { stroke: "#e15759", strokeOpacity: opacityValue }), // Equity expected allocation
Plot.ruleY([30], { stroke: "#4e79a7", strokeOpacity: opacityValue }), // Debt expected allocation
Plot.ruleY([5], { stroke: "#FFD700", strokeOpacity: opacityValue }), // Gold expected allocation
Plot.lineY(finRet, {
x: (d) => d.date,
y: (d) => d.eqty,
stroke: "#e15759"
}), // Equity - actual
Plot.lineY(finRet, {
x: (d) => d.date,
y: (d) => d.debt,
stroke: "#4e79a7"
}), // Debt - actual
Plot.lineY(finRet, {
x: (d) => d.date,
y: (d) => d.gold,
stroke: "#FFD700"
}), // Gold - actual
Plot.tip(
finRet,
Plot.pointerX({
x: "date",
y: "eqty",
title: (d) =>
d.date +
"\n\n" +
"Equity: " +
d.eqty +
" %" +
"\n" +
"Debt : " +
d.debt +
" %" +
"\n" +
"Gold : " +
d.gold +
" %"
})
)
]
})
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more