Plot.plot({
x: {
interval: 10,
tickFormat: (d) => `${d}'s`,
label: "Decade Completed"
},
y: {
label: "Count of Assessments"
},
color: {
domain: ["Poor", "Fair", "Satisfactory", "No data"],
range: ["red", "orange", "green", "#ccc"]
},
marks: [
Plot.barY(
caDams,
Plot.stackY(
Plot.groupX(
{ y: "count" },
{
x: "YearCompleted",
fill: "ConditionAssessment",
sort: "ConditionAssessment",
tip: true
}
)
)
),
Plot.ruleY([0])
]
})