csvUrl = "https://raw.githubusercontent.com/jelajahstatid/jelajahstatid.github.io/refs/heads/main/pos/2025-01-pendapatan-musik/aset/pendapatan_as_riaa.csv"Observable Plot
This code defines the URL for a CSV file containing music revenue data from RIAA. The data file is hosted on a GitHub repository.
This code loads the CSV data from the specified URL using D3.js. The d3.autoType function automatically converts numeric and date fields in the dataset for easier analysis.
revenueData = d3.csv(csvUrl, d3.autoType)This code creates a bar chart using Observable Plot. The chart visualizes inflation-adjusted music revenue (pendapatan_infl) by year (tahun) and format (format). The chart includes a color legend with 4 columns and interactive tooltips for data points.
Plot.plot({
color: {
legend: true,
columns: 4
},
marks: [
Plot.rectY(revenueData,{
y: "pendapatan_infl",
x: "tahun",
fill: "format",
tip: true
})
]
})