Public
Edited
Mar 26, 2023
Insert cell
Insert cell
holidings-raw-data-mar-26-2023@1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
holidingsRaw
Insert cell
holidingsRaw.forEach(r => {
r['currentValue'] = r['Value']*r['Owned'];
r['totalCost'] = r['costAvg']*r['Owned'];
})
Insert cell
holidingsRaw
Insert cell
filteredHoldings = holidingsRaw.filter(r => r['TICKR'] != 'ROBO')
Insert cell
Plot.plot({
marks: [
Plot.barY(filteredHoldings, {x: "TICKR", y: "totalCost", sort: {x: "y", reverse: true}, fill: 'teal'}),
Plot.ruleY([0]),
Plot.barY(filteredHoldings, {x: "TICKR", y: "currentValue", sort: {x: "y", reverse: true}, fill: 'orange'})
],
y : { domain: [0, 6000]}
})
Insert cell
Insert cell
bchart = d3.select("#big-chart")
Insert cell
aplot = Plot.plot({
marks: [
Plot.barY(filteredHoldings, {x: "TICKR", y: "totalCost", sort: {x: "y", reverse: true}, fill: 'teal'})
]
})
Insert cell
bchart.append(() => Plot.plot({
marks: [
Plot.barY(filteredHoldings, {x: "TICKR", y: "totalCost", sort: {x: "y", reverse: true}, fill: 'green'})
]
}))
Insert cell
bchart.append(() => Plot.plot({
marks: [
Plot.barX(filteredHoldings, {x: "TICKR", y: "totalCost", sort: {x: "y", reverse: true}, fill: 'yellow'})
]
}))
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more