chart = (data) => {
return Plot.plot({
width: 1000,
height: 300,
color: {
legend: true,
type: "ordinal",
scheme: "oranges",
tickFormat: (d) => drought_categories[d],
},
y: {
label: "% of Fresno County in Drought",
nice: true,
},
x: {
label: "",
},
marks: [
Plot.areaY(data, Plot.stackY({
x: "start",
y: "value",
z: "category",
fill: "category",
reverse: true,
title: (d) => `${d3.format("0.1f")(d.value)}% ${drought_categories[d.category]}`,
})),
]
})
}