Public
Edited
May 15
Insert cell
Insert cell
import {pizzaorders} from "@observablehq/data-vis-course-assignment"
Insert cell
pizzaorders
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
real0rders
X
shortname
Y
mean
orders
Color
#ff5375
Size
Facet X
season
Facet Y
Mark
rule
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
pizzaorders
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
sh0rtorders = pizzaorders.map(d => ({
shortname: d.name.split(" ")[0] }));
Insert cell
pizzaorders.slice(0, 5).map(d => ({
orderDate: d.orderDate,
type: typeof d.orderDate,
dateValue: d.orderDate ? new Date(d.orderDate) : "Invalid Date"
}))
Insert cell
realorders = pizzaorders.map(d => ({
...d,
month: d.orderDate ? new Date(d.orderDate).getMonth() + 1 : "Unknown"
}));
Insert cell
real0rders = pizzaorders.map(d => ({
...d,
shortname: d.name.split(" ")[0],
month: d.orderDate ? new Date(d.orderDate).getMonth() + 1 : "Unknown",
season: d.orderDate ?
(new Date(d.orderDate).getMonth() + 1 <= 2 || new Date(d.orderDate).getMonth() + 1 === 12 ? "Winter" :
new Date(d.orderDate).getMonth() + 1 >= 3 && new Date(d.orderDate).getMonth() + 1 <= 5 ? "Spring" :
new Date(d.orderDate).getMonth() + 1 >= 6 && new Date(d.orderDate).getMonth() + 1 <= 8 ? "Summer" :
"Fall") : "Unknown"
}));
Insert cell
filteredOrders = real0rders.filter(d => d.season === ["Winter", "Spring", "Summer", "Fall"][selectedseason])
Insert cell
colorScale = d3.scaleOrdinal()
.domain(["Winter", "Spring", "Summer", "Fall"])
.range(["#1E90FF", "#32CD32", "#FFD700", "#8B0000"]);
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Explore: I looked into the dataset and found ways to make it more legible and conveyable, such as extracting the first word out of the overly long pizza names so an actual visualization could be made. I attempted (somewhat successfully) to sort the dates into seasons by extracting the months and classifying them according to their rough season.
Insert cell
Explain: The people of California and Nevada consume more pizza in the summer. The patterns of meat consumption change as the seasons change, with buffalo and oxtail having significant increases as it gets colder. The largest single season change is sicilian consumption from around 600 in the spring down to around 375 in the summer.
Insert cell
Present: Overall, the data is remarkably consistent between the two states. Pizza consumption is roughly uniform among the heavy hitters of BBQ, Hawaiian, Margherita, Meat Lover, and Pepperoni. One interesting trend is that the standard deviation increases among the types of pizza ordered as the weather gets warmer, suggesting a possible link between temperature and disposable income or perhaps openness to trying different pizzas.
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