Public
Edited
Aug 7, 2023
Insert cell
Insert cell
viewof companiesRaw = Inputs.file({ label: "Companies list", accept: ".csv", required: true})
Insert cell
viewof metricsRaw = Inputs.file({ label: "Metrics Data", accept: ".csv", required: true })
Insert cell
Insert cell
metrics = metricsRaw.csv({ typed: true })
Insert cell
data = // Join the labels into the data, this is useful to get the categories on the data
metrics.map(d => {
const labels = companies.get(d.ciqId);

return { ...d, ...labels, year: 2023 - d.timing };
})
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
marginBottom: 110,
marginLeft: 50,
x: { tickRotate: 90 },
y: { grid: true, domain: [-0.2,0.5], ticks: 5 },
marks: [
Plot.boxY(
dataNot10,
{ fx: "timing", x: "category1", y: "roic" }
)
]
})
Insert cell
Plot.plot({
marginBottom: 50,
marginLeft: 50,
marginRight: 100,
x: { tickRotate: 90 },
y: { grid: true },
marks: [
Plot.line(
data,
{ ...grouped, strokeWidth: 3 }
),
Plot.text(
data,
Plot.selectLast({ ...grouped, stroke: "none", textAnchor: "start", dx: 5 })
)
]
})
Insert cell
normalized = Plot.map({ y: Plot.normalize("last") }, { x: "year", y: "revenue", z: "ticker" })
Insert cell
grouped = Plot.groupX(
{ x: "first", y: "mean", stroke: "first", text: "first" },
{ ...normalized, z: "category2", stroke: "category2", text: "category2" }
)
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