vega({
data: { values: xmasSongs },
title: {
text: ["Christmas Song Rankings by City"],
subtitle: ["Spotify Charts Week Ending Dec. 2, 2021", ""],
fontSize: 22
},
mark: { type: "rect", tooltip: true },
encoding: {
tooltip: [
{ field: "Song" },
{ field: "Artist" },
{ field: "Rank" },
{ field: "City" }
],
y: {
field: "Song",
axis: {
labelFontSize: 14,
titleFontSize: 18,
labelLimit: 300,
title: false
},
sort: "Rank"
},
x: {
field: "City",
axis: { labelFontSize: 14, titleFontSize: 18 },
sort: "Rank"
},
color: {
field: "Rank",
aggregate: "min",
type: "quantitative",
scale: { scheme: "inferno" },
legend: { title: "Rank", labelFontSize: 14, titleFontSize: 18 }
}
},
height: 600
})