{
const medianData = parsedOne.filter(d => d.dt_desc === "Median Sales Price");
const monthly = medianData.map(d => ({
...d,
monthName: d3.timeFormat("%b")(d.date)
}));
return vl.markBoxplot({ extent: 1.5 })
.data(monthly)
.encode({
x: {
field: "monthName", type: "ordinal",
sort: ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
title: "Month"
},
y: {
field: "value", type: "quantitative",
title: "Median Sales Price"
},
color: {
field: "monthName", type: "ordinal",
scale: { scheme: "tableau10" },
legend: { title: "Month" }
}
})
.config({
boxplot: {
rule: { strokeWidth: 3 },
box: { strokeWidth: 1 },
median: { strokeWidth: 2 },
ticks: { strokeWidth: 2 }
}
})
.width(1000)
.height(300)
.title("Seasonal Distribution of Median Home Prices (All Years)")
.render();
}