Public
Edited
May 17
Insert cell
Insert cell
companies = FileAttachment("companies.csv").csv({typed: true})

Insert cell
viewof metric = Inputs.select(
["market_cap", "earnings", "earnings_to_employee_ratio"],
{label: "Select metric:"}
)
Insert cell
chart = Plot.plot({
marginBottom: 100,
x: {
label: "Company",
tickRotate: -45
},
y: {
label: metric,
grid: true,
tickFormat: d3.format(".2s")
},
marks: [
Plot.barY(
companies
.filter(d => d[metric] != null)
.sort((a, b) => b[metric] - a[metric]),
{
x: "Company", // adjust this if your column name is different
y: metric,
title: d => `${d.Company}\n${metric}: ${d[metric]}`
}
)
]
})

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