Public
Edited
Jul 3
Insert cell
Insert cell
data = FileAttachment("car-sales.json").json().then(d => d.car_sale)

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
scatterCarSales = {
const continents = [...new Set(data.map(d => d.Continent.trim()))].sort();

const continentFilter = vl.selectPoint("Filter")
.fields(["Continent"])
.bind({
Continent: vl.menu(continents)
});

return vl.markPoint({ filled: true, size: 100 })
.data(data.map(d => ({
Continent: d.Continent.trim(),
Company: d.Company.trim(),
Sales: d.Sales
})))
.transform(
vl.filter(continentFilter)
)
.params(continentFilter)
.title("Car Sales by Company and Continent")
.encode(
vl.x().fieldQ("Sales").title("Sales"),
vl.y().fieldN("Company").sort(null).title("Company"),
vl.color().fieldN("Continent").title("Continent"),
vl.tooltip(["Company", "Sales", "Continent"])
)
.render();
}

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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