Public
Edited
Jan 2, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pizzaBySales = aq //arquero comes out of the box with ObservableHQ
.from(pizza) //converts the Array of objects into a data table
.groupby("name") //groups the data by the "name" column
.rollup({
value: (d) => op.sum(d.orders) //sum up the orders
})
.orderby(aq.desc("value")) //orders the result by value, the new variable we created with the rollup
.objects() //returns an Array of objects again
Insert cell
Insert cell
pizzaBySalesForPlot = pizzaBySales.slice(0, top).map((d) => d.name)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pizza
Type Table, then Shift-Enter. Ctrl-space for more options.

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