chart = Plot.plot({
marginLeft: 60,
height: 400,
y: {
label: chartView === "totalSpending" ? "Total Spending (Millions $)" :
chartView === "avgOrderValue" ? "Avg Order Value ($)" :
"Order Count (Millions)",
grid: true
},
marks: [
Plot.barY(regionData, {
x: "Region",
y: chartView,
fill: "#2E86C1",
tip: true
})
]
})